svashisht / rpms / bash

Forked from rpms/bash 4 years ago
Clone

Blame SOURCES/bash42-011

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