equal
deleted
inserted
replaced
1 BASH PATCH REPORT |
|
2 ================= |
|
3 |
|
4 Bash-Release: 4.2 |
|
5 Patch-ID: bash42-011 |
|
6 |
|
7 Bug-Reported-by: "David Parks" <[email protected]> |
|
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 *** ../bash-4.2-patched/assoc.c 2009-08-05 20:19:40.000000000 -0400 |
|
19 --- assoc.c 2011-10-04 20:23:07.000000000 -0400 |
|
20 *************** |
|
21 *** 78,81 **** |
|
22 --- 78,86 ---- |
|
23 if (b == 0) |
|
24 return -1; |
|
25 + /* If we are overwriting an existing element's value, we're not going to |
|
26 + use the key. Nothing in the array assignment code path frees the key |
|
27 + string, so we can free it here to avoid a memory leak. */ |
|
28 + if (b->key != key) |
|
29 + free (key); |
|
30 FREE (b->data); |
|
31 b->data = value ? savestring (value) : (char *)0; |
|
32 *** ../bash-4.2-patched/patchlevel.h Sat Jun 12 20:14:48 2010 |
|
33 --- patchlevel.h Thu Feb 24 21:41:34 2011 |
|
34 *************** |
|
35 *** 26,30 **** |
|
36 looks for to find the patch level (for the sccs version string). */ |
|
37 |
|
38 ! #define PATCHLEVEL 10 |
|
39 |
|
40 #endif /* _PATCHLEVEL_H_ */ |
|
41 --- 26,30 ---- |
|
42 looks for to find the patch level (for the sccs version string). */ |
|
43 |
|
44 ! #define PATCHLEVEL 11 |
|
45 |
|
46 #endif /* _PATCHLEVEL_H_ */ |
|