From 5a9be691858ec25697234cefc5007a8c3fc95803 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Mon, 5 Jan 2015 15:39:33 +0100 Subject: 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). --- Src/builtin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Src/builtin.c') 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) { -- cgit 1.4.1