diff options
author | Oliver Kiddle <okiddle@yahoo.co.uk> | 2018-04-07 12:51:01 +0200 |
---|---|---|
committer | Oliver Kiddle <okiddle@yahoo.co.uk> | 2018-04-07 14:37:46 +0200 |
commit | 90afd3692280499dd191239f5fd2a69b183d24e6 (patch) | |
tree | 3deed83824080ff5d051bb3a1619626f5754d05e /Src/params.c | |
parent | bd05c4b2def7defee3787df24e2cfb9f96900e6c (diff) | |
download | zsh-90afd3692280499dd191239f5fd2a69b183d24e6.tar.gz zsh-90afd3692280499dd191239f5fd2a69b183d24e6.tar.xz zsh-90afd3692280499dd191239f5fd2a69b183d24e6.zip |
42597: plug memory leak found by coverity
Diffstat (limited to 'Src/params.c')
-rw-r--r-- | Src/params.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Src/params.c b/Src/params.c index de7730ae7..36f5f0676 100644 --- a/Src/params.c +++ b/Src/params.c @@ -3216,7 +3216,7 @@ assignaparam(char *s, char **val, int flags) * This only applies if the flag ASSPM_KEY_VALUE is passed in, * indicating prefork() detected this syntax. * - * For associative arrays we just junk the Makrer elements. + * For associative arrays we just junk the Marker elements. */ if (flags & ASSPM_KEY_VALUE) { char **aptr; @@ -3243,6 +3243,7 @@ assignaparam(char *s, char **val, int flags) (!isset(KSHARRAYS) && *iptr == 0)) { unqueue_signals(); zerr("bad subscript for direct array assignment: %s", *aptr); + freearray(val); return NULL; } if (!isset(KSHARRAYS)) @@ -3260,6 +3261,7 @@ assignaparam(char *s, char **val, int flags) fullval = zshcalloc((maxlen+1) * sizeof(char *)); if (!fullval) { zerr("array too large"); + freearray(val); return NULL; } fullval[maxlen] = NULL; |