e5fbd81a61
git-svn-id: svn://svn.openwrt.org/openwrt/packages@31746 3c298f89-4303-0410-b956-a3cf2f4a3e73
42 lines
1.2 KiB
Diff
42 lines
1.2 KiB
Diff
BASH PATCH REPORT
|
|
=================
|
|
|
|
Bash-Release: 4.2
|
|
Patch-ID: bash42-011
|
|
|
|
Bug-Reported-by: "David Parks" <davidparks21@yahoo.com>
|
|
Bug-Reference-ID: <014101cc82c6$46ac1540$d4043fc0$@com>
|
|
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'):
|
|
|
|
--- 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);
|
|
--- 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_ */
|