[asterisk-commits] jrose: trunk r401793 - in /trunk: ./ tests/test_linkedlists.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Oct 24 14:57:05 CDT 2013


Author: jrose
Date: Thu Oct 24 14:57:04 2013
New Revision: 401793

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=401793
Log:
test_linkedlists: Fix memory leak

(issue ASTERISK-22467)
Reported by: Corey Farrell
Patches:
    test_linkedlists-1.8.patch uploaded by coreyfarrell (license 5909)
    test_linkedlists-11up.patch uploaded by coreyfarrell (license 5909)
........

Merged revisions 401790 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 401791 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 401792 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/tests/test_linkedlists.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/tests/test_linkedlists.c
URL: http://svnview.digium.com/svn/asterisk/trunk/tests/test_linkedlists.c?view=diff&rev=401793&r1=401792&r2=401793
==============================================================================
--- trunk/tests/test_linkedlists.c (original)
+++ trunk/tests/test_linkedlists.c Thu Oct 24 14:57:04 2013
@@ -105,19 +105,16 @@
 #define MATCH_OR_FAIL(list, val, retbuf) \
 	if (list_expect(list, val, &retbuf)) { \
 		ast_test_status_update(test, "Expected: %s, Got: %s\n", val, ast_str_buffer(retbuf)); \
-		ast_free(retbuf); \
 		return AST_TEST_FAIL; \
 	}
 
 #define MATCH_OR_FAIL_DBL(list, val, retbuf) \
 	if (dbl_list_expect_forward(list, val, &retbuf)) { \
 		ast_test_status_update(test, "Expected: %s, Got: %s\n", val, ast_str_buffer(retbuf)); \
-		ast_free(retbuf); \
 		return AST_TEST_FAIL; \
 	} \
 	if (dbl_list_expect_reverse(list, val, &retbuf)) { \
 		ast_test_status_update(test, "Expected reverse of: %s, Got: %s\n", val, ast_str_buffer(retbuf)); \
-		ast_free(retbuf); \
 		return AST_TEST_FAIL; \
 	}
 
@@ -129,7 +126,7 @@
 
 AST_TEST_DEFINE(single_ll_tests)
 {
-	struct ast_str *buf;
+	RAII_VAR(struct ast_str *, buf, NULL, ast_free);
 	struct test_llist test_list = { 0, };
 	struct test_llist other_list = { 0, };
 	struct test_val *bogus;
@@ -340,7 +337,7 @@
 
 AST_TEST_DEFINE(double_ll_tests)
 {
-	struct ast_str *buf;
+	RAII_VAR(struct ast_str *, buf, NULL, ast_free);
 	struct test_dbl_llist test_list = { 0, };
 	struct test_dbl_llist other_list = { 0, };
 	struct test_val *bogus;




More information about the asterisk-commits mailing list