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