diff options
author | Peter Stephenson <pws@zsh.org> | 2014-08-01 16:15:13 +0100 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2014-08-01 16:15:13 +0100 |
commit | b79ef8caaf00d5fb26fa968fd2789a3f969ab22c (patch) | |
tree | 9f1e0111c9ef462d5ee7820aab9b0897d642260e /Src | |
parent | 417cb94fe147a94d16e3935deb83250a51cd62a8 (diff) | |
download | zsh-b79ef8caaf00d5fb26fa968fd2789a3f969ab22c.tar.gz zsh-b79ef8caaf00d5fb26fa968fd2789a3f969ab22c.tar.xz zsh-b79ef8caaf00d5fb26fa968fd2789a3f969ab22c.zip |
32932: add hmkarray() and use to fix leak
Diffstat (limited to 'Src')
-rw-r--r-- | Src/subst.c | 2 | ||||
-rw-r--r-- | Src/utils.c | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/Src/subst.c b/Src/subst.c index 471350219..d6be2f0ed 100644 --- a/Src/subst.c +++ b/Src/subst.c @@ -2935,7 +2935,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags) */ if (!vunset) { if (isarr) { - aval = mkarray(NULL); + aval = hmkarray(NULL); } else { val = dupstring(""); } diff --git a/Src/utils.c b/Src/utils.c index aa978e6b9..998e46a36 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -3372,6 +3372,17 @@ mkarray(char *s) } /**/ +mod_export char ** +hmkarray(char *s) +{ + char **t = (char **) zhalloc((s) ? (2 * sizeof s) : (sizeof s)); + + if ((*t = s)) + t[1] = NULL; + return t; +} + +/**/ mod_export void zbeep(void) { |