[Asterisk-code-review] test sorcery memory cache thrash: Handle error from vector a... (asterisk[13])
Corey Farrell
asteriskteam at digium.com
Mon Nov 6 17:35:28 CST 2017
Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/7066
Change subject: test_sorcery_memory_cache_thrash: Handle error from vector append.
......................................................................
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
---
M tests/test_sorcery_memory_cache_thrash.c
1 file changed, 5 insertions(+), 1 deletion(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/66/7066/1
diff --git a/tests/test_sorcery_memory_cache_thrash.c b/tests/test_sorcery_memory_cache_thrash.c
index c0d25fe..dfe7a7c 100644
--- a/tests/test_sorcery_memory_cache_thrash.c
+++ b/tests/test_sorcery_memory_cache_thrash.c
@@ -218,7 +218,11 @@
/* 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;
--
To view, visit https://gerrit.asterisk.org/7066
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6eb41586fd11dee8c0dfe35e91cb465a4cab7298
Gerrit-Change-Number: 7066
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171106/3ed452b6/attachment-0001.html>
More information about the asterisk-code-review
mailing list