summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2022-12-13 12:41:47 -0500
committerChet Ramey <chet.ramey@case.edu>2022-12-13 12:41:47 -0500
commit52f2cda1a2156c8532f2f49391470cf2f66a1bd0 (patch)
treed312916282d29966c676ae3567bbf079f7108a34
parentc7bb74de78058f6381d54148465d42e8370e075a (diff)
downloadbash-52f2cda1a2156c8532f2f49391470cf2f66a1bd0.tar.gz
Bash-5.2 patch 13: fix memory leak referencing a nonexistent associative array element
-rw-r--r--patchlevel.h2
-rw-r--r--subst.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/patchlevel.h b/patchlevel.h
index bf3498f6..7ebe846a 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -25,6 +25,6 @@
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
looks for to find the patch level (for the sccs version string). */
-#define PATCHLEVEL 12
+#define PATCHLEVEL 13
#endif /* _PATCHLEVEL_H_ */
diff --git a/subst.c b/subst.c
index 7715bfbf..1ac6eb2d 100644
--- a/subst.c
+++ b/subst.c
@@ -7497,8 +7497,6 @@ expand_arrayref:
? quote_string (temp)
: quote_escapes (temp);
rflags |= W_ARRAYIND;
- if (estatep)
- *estatep = es; /* structure copy */
}
/* Note that array[*] and array[@] expanded to a quoted null string by
returning the W_HASQUOTEDNULL flag to the caller in addition to TEMP. */
@@ -7507,7 +7505,9 @@ expand_arrayref:
else if (es.subtype == 2 && temp && QUOTED_NULL (temp) && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)))
rflags |= W_HASQUOTEDNULL;
- if (estatep == 0)
+ if (estatep)
+ *estatep = es; /* structure copy */
+ else
flush_eltstate (&es);
}
#endif