summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2011-11-22 20:02:29 -0500
committerChet Ramey <chet.ramey@case.edu>2011-11-22 20:02:29 -0500
commit47a7673055e4f82ee6c803df04eb1e2a87e717b7 (patch)
treef1c478dc01fe88583bab27b633237c2428e9803d
parent680d15e19f2b8f7b6ee1535f923e7be6a95c4358 (diff)
downloadbash-47a7673055e4f82ee6c803df04eb1e2a87e717b7.tar.gz
Bash-4.2 patch 11
-rw-r--r--assoc.c5
-rw-r--r--patchlevel.h2
2 files changed, 6 insertions, 1 deletions
diff --git a/assoc.c b/assoc.c
index bbc7b177..4561de42 100644
--- 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);
diff --git a/patchlevel.h b/patchlevel.h
index 69439cb5..915746d7 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -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_ */