summary refs log tree commit diff
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2015-01-05 16:08:56 +0100
committerMikael Magnusson <mikachu@gmail.com>2015-01-06 23:47:30 +0100
commit1507719d0a5c8ff8694583fbc4c993e937fb9266 (patch)
tree38bfa3cc601cd1bf8841e41843daf582528a2fb6
parentadae710eb057c291cadd393b778416bf2de2218a (diff)
downloadzsh-1507719d0a5c8ff8694583fbc4c993e937fb9266.tar.gz
zsh-1507719d0a5c8ff8694583fbc4c993e937fb9266.tar.xz
zsh-1507719d0a5c8ff8694583fbc4c993e937fb9266.zip
34112: typeset: fix leak of oldval
Found by Coverity (Issue 1255803).
-rw-r--r--ChangeLog2
-rw-r--r--Src/builtin.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 321d9fc1d..2afb52cc2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2015-01-06  Mikael Magnusson  <mikachu@gmail.com>
 
+	* 34112: Src/builtin.c: typeset: fix leak of oldval
+
 	* 34106: Src/hist.c: use zhtricat instead of tricat
 
 	* 34113: Src/builtin.c: whence: use dupstring to not leak memory
diff --git a/Src/builtin.c b/Src/builtin.c
index 228eaaada..5138c70fd 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2510,6 +2510,8 @@ bin_typeset(char *name, char **argv, Options ops, int func)
 							  asg->name),
 				 func, (on | PM_ARRAY) & ~PM_EXPORTED,
 				 off, roff, asg->value, NULL, ops, 0))) {
+	    if (oldval)
+		zsfree(oldval);
 	    unqueue_signals();
 	    return 1;
 	}