bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bash-4.2 Official patch 11


From: Chet Ramey
Subject: Bash-4.2 Official patch 11
Date: Wed, 23 Nov 2011 16:35:07 -0500

                             BASH PATCH REPORT
                             =================

Bash-Release:   4.2
Patch-ID:       bash42-011

Bug-Reported-by:        "David Parks" <address@hidden>
Bug-Reference-ID:       <address@hidden>
Bug-Reference-URL:      
http://lists.gnu.org/archive/html/bug-bash/2011-10/msg00031.html

Bug-Description:

Overwriting a value in an associative array causes the memory allocated to
store the key on the second and subsequent assignments to leak.

Patch (apply with `patch -p0'):

*** ../bash-4.2-patched/assoc.c 2009-08-05 20:19:40.000000000 -0400
--- assoc.c     2011-10-04 20:23:07.000000000 -0400
***************
*** 78,81 ****
--- 78,86 ----
    if (b == 0)
      return -1;
+   /* If we are overwriting an existing element's value, we're not going to
+      use the key.  Nothing in the array assignment code path frees the key
+      string, so we can free it here to avoid a memory leak. */
+   if (b->key != key)
+     free (key);
    FREE (b->data);
    b->data = value ? savestring (value) : (char *)0;
*** ../bash-4.2-patched/patchlevel.h    Sat Jun 12 20:14:48 2010
--- patchlevel.h        Thu Feb 24 21:41:34 2011
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 10
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 11
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]