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