[packages] bash: import upstream 4.2 patch series
[openwrt/svn-archive/archive.git] / utils / bash / patches / 111-upstream-bash42-011.patch
1 BASH PATCH REPORT
2 =================
3
4 Bash-Release: 4.2
5 Patch-ID: bash42-011
6
7 Bug-Reported-by: "David Parks" <davidparks21@yahoo.com>
8 Bug-Reference-ID: <014101cc82c6$46ac1540$d4043fc0$@com>
9 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2011-10/msg00031.html
10
11 Bug-Description:
12
13 Overwriting a value in an associative array causes the memory allocated to
14 store the key on the second and subsequent assignments to leak.
15
16 Patch (apply with `patch -p0'):
17
18 --- a/assoc.c
19 +++ b/assoc.c
20 @@ -77,6 +77,11 @@ assoc_insert (hash, key, value)
21 b = hash_search (key, hash, HASH_CREATE);
22 if (b == 0)
23 return -1;
24 + /* If we are overwriting an existing element's value, we're not going to
25 + use the key. Nothing in the array assignment code path frees the key
26 + string, so we can free it here to avoid a memory leak. */
27 + if (b->key != key)
28 + free (key);
29 FREE (b->data);
30 b->data = value ? savestring (value) : (char *)0;
31 return (0);
32 --- a/patchlevel.h
33 +++ b/patchlevel.h
34 @@ -25,6 +25,6 @@
35 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
36 looks for to find the patch level (for the sccs version string). */
37
38 -#define PATCHLEVEL 10
39 +#define PATCHLEVEL 11
40
41 #endif /* _PATCHLEVEL_H_ */