bash44-014 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. BASH PATCH REPORT
  2. =================
  3. Bash-Release: 4.4
  4. Patch-ID: bash44-014
  5. Bug-Reported-by: Oyvind Hvidsten <oyvind.hvidsten@dhampir.no>
  6. Bug-Reference-ID: <c01b7049-925c-9409-d978-e59bf42591f4@dhampir.no>
  7. Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2017-12/msg00023.html
  8. Bug-Description:
  9. Under some circumstances, functions that return via the `return' builtin do
  10. not clean up memory they allocated to keep track of FIFOs.
  11. Patch (apply with `patch -p0'):
  12. *** ../bash-20171205/execute_cmd.c 2017-12-08 07:38:28.000000000 -0500
  13. --- execute_cmd.c 2018-01-26 15:23:38.000000000 -0500
  14. ***************
  15. *** 727,730 ****
  16. --- 727,732 ----
  17. ofifo = num_fifos ();
  18. ofifo_list = copy_fifo_list ((int *)&osize);
  19. + begin_unwind_frame ("internal_fifos");
  20. + add_unwind_protect (xfree, ofifo_list);
  21. saved_fifo = 1;
  22. }
  23. ***************
  24. *** 742,746 ****
  25. #if defined (PROCESS_SUBSTITUTION)
  26. if (saved_fifo)
  27. ! free ((void *)ofifo_list);
  28. #endif
  29. return (last_command_exit_value = EXECUTION_FAILURE);
  30. --- 744,751 ----
  31. #if defined (PROCESS_SUBSTITUTION)
  32. if (saved_fifo)
  33. ! {
  34. ! free ((void *)ofifo_list);
  35. ! discard_unwind_frame ("internal_fifos");
  36. ! }
  37. #endif
  38. return (last_command_exit_value = EXECUTION_FAILURE);
  39. ***************
  40. *** 1061,1064 ****
  41. --- 1066,1070 ----
  42. close_new_fifos ((char *)ofifo_list, osize);
  43. free ((void *)ofifo_list);
  44. + discard_unwind_frame ("internal_fifos");
  45. }
  46. #endif
  47. ***************
  48. *** 4978,4984 ****
  49. #endif
  50. ! #if defined (PROCESS_SUBSTITUTION)
  51. ofifo = num_fifos ();
  52. ofifo_list = copy_fifo_list (&osize);
  53. #endif
  54. --- 4984,4995 ----
  55. #endif
  56. ! #if defined (PROCESS_SUBSTITUTION)
  57. ! begin_unwind_frame ("saved_fifos");
  58. ! /* If we return, we longjmp and don't get a chance to restore the old
  59. ! fifo list, so we add an unwind protect to free it */
  60. ofifo = num_fifos ();
  61. ofifo_list = copy_fifo_list (&osize);
  62. + if (ofifo_list)
  63. + add_unwind_protect (xfree, ofifo_list);
  64. #endif
  65. ***************
  66. *** 5064,5068 ****
  67. if (nfifo > ofifo)
  68. close_new_fifos (ofifo_list, osize);
  69. ! free (ofifo_list);
  70. #endif
  71. --- 5075,5081 ----
  72. if (nfifo > ofifo)
  73. close_new_fifos (ofifo_list, osize);
  74. ! if (ofifo_list)
  75. ! free (ofifo_list);
  76. ! discard_unwind_frame ("saved_fifos");
  77. #endif
  78. *** ../bash-4.4/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
  79. --- patchlevel.h 2016-10-01 11:01:28.000000000 -0400
  80. ***************
  81. *** 26,30 ****
  82. looks for to find the patch level (for the sccs version string). */
  83. ! #define PATCHLEVEL 13
  84. #endif /* _PATCHLEVEL_H_ */
  85. --- 26,30 ----
  86. looks for to find the patch level (for the sccs version string). */
  87. ! #define PATCHLEVEL 14
  88. #endif /* _PATCHLEVEL_H_ */