summary refs log tree commit diff
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2015-01-06 00:40:23 +0100
committerMikael Magnusson <mikachu@gmail.com>2015-01-06 23:51:00 +0100
commit6a5339fdd517fc59ce576cf3bbd0cd73c0edfa14 (patch)
treee007922d263cc164d70edc88acc188038a72cdc3
parentbd2175fe7dad87575ae838fa116226aff4c18191 (diff)
downloadzsh-6a5339fdd517fc59ce576cf3bbd0cd73c0edfa14.tar.gz
zsh-6a5339fdd517fc59ce576cf3bbd0cd73c0edfa14.tar.xz
zsh-6a5339fdd517fc59ce576cf3bbd0cd73c0edfa14.zip
34107: getsubsargs: free ptr1 before returning
Found by Coverity (Issue 439073).
-rw-r--r--ChangeLog2
-rw-r--r--Src/hist.c1
2 files changed, 3 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index f54188af9..1b3076632 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2015-01-06  Mikael Magnusson  <mikachu@gmail.com>
 
+	* 34107: Src/hist.c: getsubsargs: free ptr1 before returning
+
 	* 34134: Src/exec.c: anon funcs: don't leak shf and related data
 
 	* 34112: Src/builtin.c: typeset: fix leak of oldval
diff --git a/Src/hist.c b/Src/hist.c
index d8192c1c5..e65d78bfd 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -367,6 +367,7 @@ getsubsargs(char *subline, int *gbalp, int *cflagp)
 	zsfree(hsubl);
 	hsubl = ptr1;
     } else if (!hsubl) {		/* fail silently on this */
+	zsfree(ptr1);
 	zsfree(ptr2);
 	return 0;
     }