mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +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 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@401662 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user