2
1

bash-4.2-011.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. BASH PATCH REPORT
  2. =================
  3. Bash-Release: 4.2
  4. Patch-ID: bash42-011
  5. Bug-Reported-by: "David Parks" <davidparks21@yahoo.com>
  6. Bug-Reference-ID: <014101cc82c6$46ac1540$d4043fc0$@com>
  7. Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2011-10/msg00031.html
  8. Bug-Description:
  9. Overwriting a value in an associative array causes the memory allocated to
  10. store the key on the second and subsequent assignments to leak.
  11. Patch (apply with `patch -p0'):
  12. *** ../bash-4.2-patched/assoc.c 2009-08-05 20:19:40.000000000 -0400
  13. --- ./assoc.c 2011-10-04 20:23:07.000000000 -0400
  14. ***************
  15. *** 78,81 ****
  16. --- 78,86 ----
  17. if (b == 0)
  18. return -1;
  19. + /* If we are overwriting an existing element's value, we're not going to
  20. + use the key. Nothing in the array assignment code path frees the key
  21. + string, so we can free it here to avoid a memory leak. */
  22. + if (b->key != key)
  23. + free (key);
  24. FREE (b->data);
  25. b->data = value ? savestring (value) : (char *)0;
  26. *** ../bash-4.2-patched/patchlevel.h Sat Jun 12 20:14:48 2010
  27. --- ./patchlevel.h Thu Feb 24 21:41:34 2011
  28. ***************
  29. *** 26,30 ****
  30. looks for to find the patch level (for the sccs version string). */
  31. ! #define PATCHLEVEL 10
  32. #endif /* _PATCHLEVEL_H_ */
  33. --- 26,30 ----
  34. looks for to find the patch level (for the sccs version string). */
  35. ! #define PATCHLEVEL 11
  36. #endif /* _PATCHLEVEL_H_ */