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