]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
Bash-5.2 patch 13: fix memory leak referencing a nonexistent associative array element
authorChet Ramey <chet.ramey@case.edu>
Tue, 13 Dec 2022 17:41:47 +0000 (12:41 -0500)
committerChet Ramey <chet.ramey@case.edu>
Tue, 13 Dec 2022 17:41:47 +0000 (12:41 -0500)
patchlevel.h
subst.c

index bf3498f6d841d084482a80a6a9958ca052400907..7ebe846a73ec3ff9d8836ae1af406cb041ad8267 100644 (file)
@@ -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 7715bfbf539fcdfb4fa5bda73c44a2fe1ce46daa..1ac6eb2d911650b3d6ecccab619183d136a3f524 100644 (file)
--- 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