summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorJonathan Rose <jrose@digium.com>2013-10-23 20:10:30 +0000
committerJonathan Rose <jrose@digium.com>2013-10-23 20:10:30 +0000
commitbeb5cdbef54908cc1564539f9cfb8852b530f2bc (patch)
treeb996e266a664ff749c2c8c36269934c46216109f /main
parentd7bac6cf4b981d7e393902227497b51fb47f671e (diff)
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
Diffstat (limited to 'main')
-rw-r--r--main/editline/readline.c7
-rw-r--r--main/test.c1
2 files changed, 7 insertions, 1 deletions
diff --git a/main/editline/readline.c b/main/editline/readline.c
index adf054d63..d202adbbd 100644
--- a/main/editline/readline.c
+++ b/main/editline/readline.c
@@ -1236,8 +1236,11 @@ filename_completion_function(const char *text, int state)
filename_len = strlen(filename);
dir = opendir(dirname ? dirname : ".");
- if (!dir)
+ if (!dir) {
+ free(filename);
+ free(dirname);
return (NULL); /* cannot open the directory */
+ }
/* find the match */
while ((entry = readdir(dir)) != NULL) {
@@ -1274,6 +1277,8 @@ filename_completion_function(const char *text, int state)
} else
temp = NULL;
closedir(dir);
+ free(filename);
+ free(dirname);
return (temp);
}
diff --git a/main/test.c b/main/test.c
index fdc4916e1..94713e0e7 100644
--- a/main/test.c
+++ b/main/test.c
@@ -1053,6 +1053,7 @@ void __ast_test_suite_event_notify(const char *file, const char *func, int line,
static void test_cleanup(void)
{
+ ast_cli_unregister_multiple(test_cli, ARRAY_LEN(test_cli));
ao2_cleanup(test_suite_topic);
test_suite_topic = NULL;
STASIS_MESSAGE_TYPE_CLEANUP(ast_test_suite_message_type);