Fix minor memory leak from tab completion (bug #2059)
authorMark Spencer <markster@digium.com>
Fri, 16 Jul 2004 20:41:17 +0000 (20:41 +0000)
committerMark Spencer <markster@digium.com>
Fri, 16 Jul 2004 20:41:17 +0000 (20:41 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3448 65c4cc65-6c06-0410-ace0-fbb531ad65f3

asterisk.c

index 439cbb4..9c58a2c 100755 (executable)
@@ -1131,11 +1131,15 @@ static int ast_cli_display_match_list(char **matches, int len, int max)
                        /* Don't print dupes */
                        if ( (matches[idx+1] != NULL && strcmp(matches[idx], matches[idx+1]) == 0 ) ) {
                                i--;
+                               free(matches[idx]);
+                               matches[idx] = NULL;
                                continue;
                        }
 
                        numoutput++;  numoutputline++;
                        fprintf(stdout, "%-*s  ", max, matches[idx]);
+                       free(matches[idx]);
+                       matches[idx] = NULL;
                }
                if (numoutputline > 0)
                        fprintf(stdout, "\n");