diff options
author | Barton E. Schaefer <schaefer@zsh.org> | 2017-06-19 16:06:38 -0700 |
---|---|---|
committer | Barton E. Schaefer <schaefer@zsh.org> | 2017-06-19 16:06:38 -0700 |
commit | a5ed661f256b424a2db60b9dbacadc94fe78d843 (patch) | |
tree | c589bfa85da07cfc2d768ccddb9cfec1f1830e1c | |
parent | efae75f64868361e5e25d0094a127c4b0c52d62d (diff) | |
download | zsh-a5ed661f256b424a2db60b9dbacadc94fe78d843.tar.gz zsh-a5ed661f256b424a2db60b9dbacadc94fe78d843.tar.xz zsh-a5ed661f256b424a2db60b9dbacadc94fe78d843.zip |
41317: use heap allocation in getoutputfile() to plug memory leak
Heap is usable ever since addfilelist() of workers/31528 (commit 3c573222).
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Src/exec.c | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index bfd370fcc..bff13b443 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2017-06-19 Barton E. Schaefer <schaefer@zsh.org> + + * 41317: Src/exec.c: use heap allocation in getoutputfile() to + plug memory leak + 2017-06-17 Barton E. Schaefer <schaefer@zsh.org> * 41242: Src/Zle/compcore.c, Src/Zle/zle_tricky.c: zstrbcmp(...) 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; } } } |