From 1a08dbc45c0f4d1d813c9dfcf3ea1f72d0a4c3ff Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sat, 16 Jan 2016 19:14:58 +0000 Subject: [PATCH] Expansions: avoid releasing memory used for $value in ${run } --- src/src/expand.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/src/expand.c b/src/src/expand.c index 85d8c6a27..c78040ea7 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -3187,7 +3187,7 @@ if (*s == '}') } else { - if (yes && lookup_value != NULL) + if (yes && lookup_value) *yieldptr = string_cat(*yieldptr, sizeptr, ptrptr, lookup_value, Ustrlen(lookup_value)); lookup_value = save_lookup; @@ -4929,8 +4929,10 @@ while (*s != 0) /* Read the pipe to get the command's output into $value (which is kept in lookup_value). Read during execution, so that if the output exceeds - the OS pipe buffer limit, we don't block forever. */ + the OS pipe buffer limit, we don't block forever. Remember to not release + memory just allocated for $value. */ + resetok = FALSE; f = fdopen(fd_out, "rb"); sigalrm_seen = FALSE; alarm(60); -- 2.25.1