mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-18 18:58:22 +00:00
memory leaks: Memory leak cleanup patch by Corey Farrell (first set)
(issue ASTERSIK-22467) Reported by: Corey Farrell Patches: chan_sip-parse_contact_header_test-free-contacts.patch uploaded by coreyfarrell (license 5909) cli-filename-completion-leak.patch uploaded by coreyfarrell (license 5909) func_math.patch uploaded by corefarrell (license 5909) main-test-cleanup.patch uploaded by coreyfarrell (license 5909) test_dlinklists.patch uploaded by coreyfarrell (license 5909) ........ Merged revisions 401660 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 401661 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 401662 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@401663 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1562,6 +1562,10 @@ AST_TEST_DEFINE(parse_contact_header_test)
|
|||||||
|
|
||||||
contactptr = AST_LIST_NEXT(contactptr,list);
|
contactptr = AST_LIST_NEXT(contactptr,list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while ((contactptr = AST_LIST_REMOVE_HEAD(contactlistptr,list))) {
|
||||||
|
ast_free(contactptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -503,6 +503,9 @@ AST_TEST_DEFINE(test_MATH_function)
|
|||||||
res = AST_TEST_FAIL;
|
res = AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ast_free(expr);
|
||||||
|
ast_free(result);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1236,8 +1236,11 @@ filename_completion_function(const char *text, int state)
|
|||||||
filename_len = strlen(filename);
|
filename_len = strlen(filename);
|
||||||
|
|
||||||
dir = opendir(dirname ? dirname : ".");
|
dir = opendir(dirname ? dirname : ".");
|
||||||
if (!dir)
|
if (!dir) {
|
||||||
|
free(filename);
|
||||||
|
free(dirname);
|
||||||
return (NULL); /* cannot open the directory */
|
return (NULL); /* cannot open the directory */
|
||||||
|
}
|
||||||
|
|
||||||
/* find the match */
|
/* find the match */
|
||||||
while ((entry = readdir(dir)) != NULL) {
|
while ((entry = readdir(dir)) != NULL) {
|
||||||
@@ -1274,6 +1277,8 @@ filename_completion_function(const char *text, int state)
|
|||||||
} else
|
} else
|
||||||
temp = NULL;
|
temp = NULL;
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
|
free(filename);
|
||||||
|
free(dirname);
|
||||||
|
|
||||||
return (temp);
|
return (temp);
|
||||||
}
|
}
|
||||||
|
@@ -1053,6 +1053,7 @@ void __ast_test_suite_event_notify(const char *file, const char *func, int line,
|
|||||||
|
|
||||||
static void test_cleanup(void)
|
static void test_cleanup(void)
|
||||||
{
|
{
|
||||||
|
ast_cli_unregister_multiple(test_cli, ARRAY_LEN(test_cli));
|
||||||
ao2_cleanup(test_suite_topic);
|
ao2_cleanup(test_suite_topic);
|
||||||
test_suite_topic = NULL;
|
test_suite_topic = NULL;
|
||||||
STASIS_MESSAGE_TYPE_CLEANUP(ast_test_suite_message_type);
|
STASIS_MESSAGE_TYPE_CLEANUP(ast_test_suite_message_type);
|
||||||
|
@@ -337,6 +337,7 @@ static void dll_tests(void)
|
|||||||
|
|
||||||
if (e == b) {
|
if (e == b) {
|
||||||
AST_DLLIST_REMOVE_CURRENT(list); /* C A */
|
AST_DLLIST_REMOVE_CURRENT(list); /* C A */
|
||||||
|
free(b);
|
||||||
print_list(tc, "C <=> A");
|
print_list(tc, "C <=> A");
|
||||||
}
|
}
|
||||||
if (e == a) {
|
if (e == a) {
|
||||||
@@ -348,6 +349,7 @@ static void dll_tests(void)
|
|||||||
AST_DLLIST_TRAVERSE_SAFE_END;
|
AST_DLLIST_TRAVERSE_SAFE_END;
|
||||||
print_list(tc, "C <=> A <=> D");
|
print_list(tc, "C <=> A <=> D");
|
||||||
|
|
||||||
|
destroy_test_container(tc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int unload_module(void)
|
static int unload_module(void)
|
||||||
|
Reference in New Issue
Block a user