diff options
Diffstat (limited to 'main/editline/readline.c')
-rw-r--r-- | main/editline/readline.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/main/editline/readline.c b/main/editline/readline.c index 4729fa952..77827c3f9 100644 --- a/main/editline/readline.c +++ b/main/editline/readline.c @@ -549,6 +549,7 @@ _history_expand_command(const char *command, size_t cmdlen, char **result) from = strdup(search); else { from = NULL; + free(line); return (-1); } } @@ -609,8 +610,13 @@ _history_expand_command(const char *command, size_t cmdlen, char **result) end = max - ((end < -1) ? 1 : 0); /* check boundaries ... */ - if (start > max || end > max || start > end) + if (start > max || end > max || start > end) { + for (i = 0; i <= max; i++) { + free(arr[i]); + } + free(arr), arr = (char **) NULL; return (-1); + } for (i = 0; i <= max; i++) { char *temp; |