about summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2015-01-05 15:39:33 +0100
committerMikael Magnusson <mikachu@gmail.com>2015-01-06 23:47:12 +0100
commit5a9be691858ec25697234cefc5007a8c3fc95803 (patch)
tree24e57233e04ace30385b1883f92b02028b8a6028 /Src/builtin.c
parent8035794a56eec3539fb1080ca3818237ed504349 (diff)
downloadzsh-5a9be691858ec25697234cefc5007a8c3fc95803.tar.gz
zsh-5a9be691858ec25697234cefc5007a8c3fc95803.tar.xz
zsh-5a9be691858ec25697234cefc5007a8c3fc95803.zip
34113: whence: use dupstring to not leak memory
All other assignments to buf use the heap, and it's never freed. Found
by Coverity (Issue 1255786).
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index afa836a03..228eaaada 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3323,7 +3323,7 @@ bin_whence(char *nam, char **argv, Options ops, int func)
 	    for (pp = path; *pp; pp++) {
 		if (**pp) {
 		    buf = zhtricat(*pp, "/", *argv);
-		} else buf = ztrdup(*argv);
+		} else buf = dupstring(*argv);
 
 		if (iscom(buf)) {
 		    if (wd) {