diff options
Diffstat (limited to 'main/editline/tokenizer.c')
-rw-r--r-- | main/editline/tokenizer.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/main/editline/tokenizer.c b/main/editline/tokenizer.c index f0de39bc9..67398c686 100644 --- a/main/editline/tokenizer.c +++ b/main/editline/tokenizer.c @@ -113,12 +113,17 @@ tok_init(const char *ifs) tok->argc = 0; tok->amax = AINCR; tok->argv = (char **) tok_malloc(sizeof(char *) * tok->amax); - if (tok->argv == NULL) + if (tok->argv == NULL) { + tok_free(tok); return (NULL); + } tok->argv[0] = NULL; tok->wspace = (char *) tok_malloc(WINCR); - if (tok->wspace == NULL) + if (tok->wspace == NULL) { + tok_free(tok->argv); + tok_free(tok); return (NULL); + } tok->wmax = tok->wspace + WINCR; tok->wstart = tok->wspace; tok->wptr = tok->wspace; |