Fix minor memory leak from tab completion (bug #2059)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3448 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer 2004-07-16 20:41:17 +00:00
parent eac29e9814
commit d5c614397a
1 changed files with 4 additions and 0 deletions

View File

@ -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");