07a490
			     BASH PATCH REPORT
07a490
			     =================
07a490
07a490
Bash-Release:	4.2
07a490
Patch-ID:	bash42-011
07a490
07a490
Bug-Reported-by:	"David Parks" <davidparks21@yahoo.com>
07a490
Bug-Reference-ID:	<014101cc82c6$46ac1540$d4043fc0$@com>
07a490
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2011-10/msg00031.html
07a490
07a490
Bug-Description:
07a490
07a490
Overwriting a value in an associative array causes the memory allocated to
07a490
store the key on the second and subsequent assignments to leak.
07a490
07a490
Patch (apply with `patch -p0'):
07a490
07a490
*** ../bash-4.2-patched/assoc.c	2009-08-05 20:19:40.000000000 -0400
07a490
--- assoc.c	2011-10-04 20:23:07.000000000 -0400
07a490
***************
07a490
*** 78,81 ****
07a490
--- 78,86 ----
07a490
    if (b == 0)
07a490
      return -1;
07a490
+   /* If we are overwriting an existing element's value, we're not going to
07a490
+      use the key.  Nothing in the array assignment code path frees the key
07a490
+      string, so we can free it here to avoid a memory leak. */
07a490
+   if (b->key != key)
07a490
+     free (key);
07a490
    FREE (b->data);
07a490
    b->data = value ? savestring (value) : (char *)0;
07a490
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
07a490
--- patchlevel.h	Thu Feb 24 21:41:34 2011
07a490
***************
07a490
*** 26,30 ****
07a490
     looks for to find the patch level (for the sccs version string). */
07a490
  
07a490
! #define PATCHLEVEL 10
07a490
  
07a490
  #endif /* _PATCHLEVEL_H_ */
07a490
--- 26,30 ----
07a490
     looks for to find the patch level (for the sccs version string). */
07a490
  
07a490
! #define PATCHLEVEL 11
07a490
  
07a490
  #endif /* _PATCHLEVEL_H_ */