From a5ed661f256b424a2db60b9dbacadc94fe78d843 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Mon, 19 Jun 2017 16:06:38 -0700 Subject: 41317: use heap allocation in getoutputfile() to plug memory leak Heap is usable ever since addfilelist() of workers/31528 (commit 3c573222). --- Src/exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Src/exec.c') diff --git a/Src/exec.c b/Src/exec.c index debb0aeca..0a9687998 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -4570,7 +4570,7 @@ getoutputfile(char *cmd, char **eptr) } if (!(prog = parsecmd(cmd, eptr))) return NULL; - if (!(nam = gettempname(NULL, 0))) + if (!(nam = gettempname(NULL, 1))) return NULL; if ((s = simple_redir_name(prog, REDIR_HERESTR))) { @@ -4601,7 +4601,7 @@ getoutputfile(char *cmd, char **eptr) suffix = dyncat(nam, unmeta(suffix)); if (link(nam, suffix) == 0) { addfilelist(nam, 0); - nam = ztrdup(suffix); + nam = suffix; } } } -- cgit 1.4.1