summary refs log tree commit diff
path: root/Src/params.c
diff options
context:
space:
mode:
authorOliver Kiddle <okiddle@yahoo.co.uk>2018-04-07 12:51:01 +0200
committerOliver Kiddle <okiddle@yahoo.co.uk>2018-04-07 14:37:46 +0200
commit90afd3692280499dd191239f5fd2a69b183d24e6 (patch)
tree3deed83824080ff5d051bb3a1619626f5754d05e /Src/params.c
parentbd05c4b2def7defee3787df24e2cfb9f96900e6c (diff)
downloadzsh-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.c4
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;