~doko/+junk/pkg-bash-debian

« back to all changes in this revision

Viewing changes to patches/bash42-011.diff

  • Committer: Matthias Klose
  • Date: 2015-01-29 23:36:31 UTC
  • Revision ID: doko@18xx.org-20150129233631-3k2rxji5gnrc47vh
4.3 updates up to 4.3-12

Show diffs side-by-side

added added

removed removed

Lines of Context:
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/bash/assoc.c
19
 
+++ b/bash/assoc.c
20
 
@@ -77,6 +77,11 @@
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/bash/patchlevel.h
33
 
+++ b/bash/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_ */