1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-11 13:01:28 +02:00

41317: use heap allocation in getoutputfile() to plug memory leak

Heap is usable ever since addfilelist() of workers/31528 (commit 3c573222).
This commit is contained in:
Barton E. Schaefer 2017-06-19 16:06:38 -07:00
parent efae75f648
commit a5ed661f25
2 changed files with 7 additions and 2 deletions

View file

@ -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(...)

View file

@ -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;
}
}
}