BASH PATCH REPORT ================= Bash-Release: 4.3 Patch-ID: bash43-040 Bug-Reported-by: Jean Delvare Bug-Reference-ID: <20150609180231.5f463695@endymion.delvare> Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2015-06/msg00033.html Bug-Description: There is a memory leak that occurs when bash expands an array reference on the rhs of an assignment statement. Patch (apply with `patch -p0'): --- a/subst.c +++ b/subst.c @@ -5782,7 +5782,7 @@ expand_arrayref: /* XXX - does this leak if name[@] or name[*]? */ if (pflags & PF_ASSIGNRHS) { - temp = array_variable_name (name, &tt, (int *)0); + var = array_variable_part (name, &tt, (int *)0); if (ALL_ELEMENT_SUB (tt[0]) && tt[1] == ']') temp = array_value (name, quoted|Q_DOUBLE_QUOTES, 0, &atype, &ind); else --- 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 39 +#define PATCHLEVEL 40 #endif /* _PATCHLEVEL_H_ */