From 4608712264c8549a9217dfa209ed6bdfeb941355 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 1 Jun 2000 09:10:15 +0000 Subject: FR & pws: promptexpand memory leaks; NEWS notes --- Src/subst.c | 12 +++++++++--- Src/utils.c | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'Src') diff --git a/Src/subst.c b/Src/subst.c index c404f794d..a6d98a8c1 100644 --- a/Src/subst.c +++ b/Src/subst.c @@ -1661,18 +1661,24 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) aval = arrdup(aval), copied = 1; ap = aval; for (; *ap; ap++) { + char *tmps; unmetafy(*ap, &len); untokenize(*ap); - *ap = unmetafy(promptexpand(metafy(*ap, len, META_NOALLOC), - 0, NULL, NULL), &len); + tmps = unmetafy(promptexpand(metafy(*ap, len, META_NOALLOC), + 0, NULL, NULL), &len); + *ap = dupstring(tmps); + free(tmps); } } else { + char *tmps; if (!copied) val = dupstring(val), copied = 1; unmetafy(val, &len); untokenize(val); - val = unmetafy(promptexpand(metafy(val, len, META_NOALLOC), + tmps = unmetafy(promptexpand(metafy(val, len, META_NOALLOC), 0, NULL, NULL), &len); + val = dupstring(tmps); + free(tmps); } opts[PROMPTSUBST] = ops; opts[PROMPTBANG] = opb; diff --git a/Src/utils.c b/Src/utils.c index 116c8089e..b4be1c4f1 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -807,6 +807,7 @@ printprompt4(void) opts[XTRACE] = t; fprintf(xtrerr, "%s", s); + free(s); } } -- cgit 1.4.1