]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
Bash-4.2 patch 11
authorChet Ramey <chet.ramey@case.edu>
Wed, 23 Nov 2011 01:02:29 +0000 (20:02 -0500)
committerChet Ramey <chet.ramey@case.edu>
Wed, 23 Nov 2011 01:02:29 +0000 (20:02 -0500)
assoc.c
patchlevel.h

diff --git a/assoc.c b/assoc.c
index bbc7b177720245f0a9255bfa3007e46875064c59..4561de4247530f9f6d08d3ec7c6406a3b24b66a0 100644 (file)
--- a/assoc.c
+++ b/assoc.c
@@ -77,6 +77,11 @@ assoc_insert (hash, key, value)
   b = hash_search (key, hash, HASH_CREATE);
   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;
   return (0);
index 69439cb54cf75db1698bc2a6705eb76380af7785..915746d715c368454e9f6cba524bc50315618a16 100644 (file)
@@ -25,6 +25,6 @@
    regexp `^#define[   ]*PATCHLEVEL', since that's what support/mkversion.sh
    looks for to find the patch level (for the sccs version string). */
 
-#define PATCHLEVEL 10
+#define PATCHLEVEL 11
 
 #endif /* _PATCHLEVEL_H_ */