summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2017-11-06 18:33:13 -0500
committerCorey Farrell <git@cfware.com>2017-11-06 18:35:27 -0500
commit8cdc0ef38572ae9d97122c6551cb40093919c190 (patch)
tree389cadadf864e3f92e695af62138949cb2f6aee0 /tests
parentad7860fd194b69a86f43b41d6c20cdb2b653481d (diff)
test_sorcery_memory_cache_thrash: Handle error from vector append.
Cleanup resources when we fail to append the vector and report test failure. Change-Id: I6eb41586fd11dee8c0dfe35e91cb465a4cab7298
Diffstat (limited to 'tests')
-rw-r--r--tests/test_sorcery_memory_cache_thrash.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/test_sorcery_memory_cache_thrash.c b/tests/test_sorcery_memory_cache_thrash.c
index c0d25feb3..dfe7a7c81 100644
--- a/tests/test_sorcery_memory_cache_thrash.c
+++ b/tests/test_sorcery_memory_cache_thrash.c
@@ -218,7 +218,11 @@ static struct sorcery_memory_cache_thrash *sorcery_memory_cache_thrash_create(co
/* This purposely holds no ref as the main thrash structure does */
thread->sorcery = thrash->sorcery;
- AST_VECTOR_APPEND(&thrash->threads, thread);
+ if (AST_VECTOR_APPEND(&thrash->threads, thread)) {
+ ast_free(thread);
+ ao2_ref(thrash, -1);
+ return NULL;
+ }
}
return thrash;