[asterisk-commits] kmoore: branch kmoore/stasis-mwi r382483 - /team/kmoore/stasis-mwi/tests/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Mar 6 07:05:10 CST 2013
Author: kmoore
Date: Wed Mar 6 07:05:05 2013
New Revision: 382483
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382483
Log:
resolve some ref leaks in test_stasis
Modified:
team/kmoore/stasis-mwi/tests/test_stasis.c
Modified: team/kmoore/stasis-mwi/tests/test_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/tests/test_stasis.c?view=diff&rev=382483&r1=382482&r2=382483
==============================================================================
--- team/kmoore/stasis-mwi/tests/test_stasis.c (original)
+++ team/kmoore/stasis-mwi/tests/test_stasis.c Wed Mar 6 07:05:05 2013
@@ -569,7 +569,6 @@
RAII_VAR(struct stasis_message *, test_message1_clear, NULL, ao2_cleanup);
int actual_len;
struct stasis_cache_update *actual_update;
- struct stasis_message *actual_message;
struct ao2_container *cache_dump;
switch (cmd) {
@@ -636,8 +635,9 @@
ast_test_validate(test, topic == actual_update->topic);
ast_test_validate(test, NULL == actual_update->old_snapshot);
ast_test_validate(test, test_message1_1 == actual_update->new_snapshot);
- actual_message = stasis_cache_get(caching_topic, cache_type, "1");
- ast_test_validate(test, test_message1_1 == actual_message);
+ ast_test_validate(test, test_message1_1 == stasis_cache_get(caching_topic, cache_type, "1"));
+ /* stasis_cache_get returned a ref, so unref test_message1_1 */
+ ao2_ref(test_message1_1, -1);
ast_test_validate(test, stasis_cache_update() == stasis_message_type(consumer->messages_rxed[1]));
actual_update = stasis_message_data(consumer->messages_rxed[1]);
@@ -645,6 +645,8 @@
ast_test_validate(test, NULL == actual_update->old_snapshot);
ast_test_validate(test, test_message2_1 == actual_update->new_snapshot);
ast_test_validate(test, test_message2_1 == stasis_cache_get(caching_topic, cache_type, "2"));
+ /* stasis_cache_get returned a ref, so unref test_message2_1 */
+ ao2_ref(test_message2_1, -1);
/* Update snapshot 2 */
test_message2_2 = cache_test_message_create(cache_type, "2", "2");
@@ -659,6 +661,8 @@
ast_test_validate(test, test_message2_1 == actual_update->old_snapshot);
ast_test_validate(test, test_message2_2 == actual_update->new_snapshot);
ast_test_validate(test, test_message2_2 == stasis_cache_get(caching_topic, cache_type, "2"));
+ /* stasis_cache_get returned a ref, so unref test_message2_2 */
+ ao2_ref(test_message2_2, -1);
/* Dump the cache to ensure that it has the correct number of items in it */
cache_dump = stasis_cache_dump(caching_topic, NULL);
More information about the asterisk-commits
mailing list