Fix some leaks in CLI (thanks James)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@777 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2003-04-08 13:45:36 +00:00
parent 09e1c34d99
commit 4952835d93
2 changed files with 15 additions and 7 deletions

View File

@@ -686,14 +686,14 @@ static int ast_el_read_char(EditLine *el, char *cp)
static char *cli_prompt(EditLine *el)
{
char prompt[80];
static char prompt[80];
if (remotehostname)
snprintf(prompt, sizeof(prompt), ASTERISK_PROMPT2, remotehostname);
else
snprintf(prompt, sizeof(prompt), ASTERISK_PROMPT);
return strdup(prompt);
return(prompt);
}
static char **ast_el_strtoarr(char *buf)
@@ -839,7 +839,7 @@ static char *cli_complete(EditLine *el, int ch)
if (nummatches == 1) {
/* Found an exact match */
el_insertstr(el, strdup(" "));
el_insertstr(el, " ");
retval = CC_REFRESH;
} else {
/* Must be more than one match */
@@ -854,11 +854,11 @@ static char *cli_complete(EditLine *el, int ch)
ast_cli_display_match_list(matches, nummatches, maxlen);
retval = CC_REDISPLAY;
} else {
el_insertstr(el,strdup(" "));
el_insertstr(el," ");
retval = CC_REFRESH;
}
}
free(matches);
}
return (char *)retval;