Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH 10/17: whence: use dupstring to not leak memory
- X-seq: zsh-workers 34113
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: PATCH 10/17: whence: use dupstring to not leak memory
- Date: Tue, 6 Jan 2015 06:25:42 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=qulcKpXzH3vNUrOiJFjcmfXsxmfJuu43XbDQ2nw6TrA=; b=vrLedmC9IOcV2g8ABQ0NLSTVYnCyZIaSGooeLoza8M64kZ7b0X3dU+STJ5OlIMS0gs 810YBqQiZgVuvv1TbuEBGoteKVYKN2gAyE2z3sYvKHnM23F6aIRBIM2yWX8H7jFQ7b1r yCqNMiENhWDATrx4yUhHidqNdBwMR2CFaaDnOA8hZ1Wl+P26JxMF5an+pmysA8eLMgc+ ChPvFL1AJqy8xpckDXiaoJkhGsKoOVDzOpxFuHTQVMMvVq4gbu1naUhz0chRCzVBB9HK i4fg3ESyGHLfq7Uk8bqOJfV4bdQCQvk5s/xqhrqN9XkYveKYMOg0zOqUzVP8LmhMaqF7 ybBg==
- In-reply-to: <1420521949-30483-1-git-send-email-mikachu@gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1420521949-30483-1-git-send-email-mikachu@gmail.com>
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(-)
diff --git a/Src/builtin.c b/Src/builtin.c
index 2b9c4de..ae7f53b 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3322,7 +3322,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) {
--
2.2.0.GIT
Messages sorted by:
Reverse Date,
Date,
Thread,
Author