Blame SOURCES/bash-4.4-patch-14.patch

9014c4
From 2fb21d75bfddd724b0e45d4a51455a166467e496 Mon Sep 17 00:00:00 2001
9014c4
From: Chet Ramey <chet.ramey@case.edu>
9014c4
Date: Mon, 29 Jan 2018 16:03:47 -0500
9014c4
Subject: [PATCH] Bash-4.4 patch 14
9014c4
9014c4
---
9014c4
 execute_cmd.c | 19 ++++++++++++++++---
9014c4
 patchlevel.h  |  2 +-
9014c4
 2 files changed, 17 insertions(+), 4 deletions(-)
9014c4
9014c4
diff --git a/execute_cmd.c b/execute_cmd.c
9014c4
index 2a3df6d6..76a80766 100644
9014c4
--- a/execute_cmd.c
9014c4
+++ b/execute_cmd.c
9014c4
@@ -726,6 +726,8 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
9014c4
     {
9014c4
       ofifo = num_fifos ();
9014c4
       ofifo_list = copy_fifo_list ((int *)&osize);
9014c4
+      begin_unwind_frame ("internal_fifos");
9014c4
+      add_unwind_protect (xfree, ofifo_list);
9014c4
       saved_fifo = 1;
9014c4
     }
9014c4
   else
9014c4
@@ -741,7 +743,10 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
9014c4
       dispose_exec_redirects ();
9014c4
 #if defined (PROCESS_SUBSTITUTION)
9014c4
       if (saved_fifo)
9014c4
-	free ((void *)ofifo_list);
9014c4
+        {
9014c4
+	  free ((void *)ofifo_list);
9014c4
+	  discard_unwind_frame ("internal_fifos");
9014c4
+        }
9014c4
 #endif
9014c4
       return (last_command_exit_value = EXECUTION_FAILURE);
9014c4
     }
9014c4
@@ -1060,6 +1065,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
9014c4
       if (nfifo > ofifo)
9014c4
 	close_new_fifos ((char *)ofifo_list, osize);
9014c4
       free ((void *)ofifo_list);
9014c4
+      discard_unwind_frame ("internal_fifos");
9014c4
     }
9014c4
 #endif
9014c4
 
9014c4
@@ -4977,9 +4983,14 @@ execute_builtin_or_function (words, builtin, var, redirects,
9014c4
   char *ofifo_list;
9014c4
 #endif
9014c4
 
9014c4
-#if defined (PROCESS_SUBSTITUTION)  
9014c4
+#if defined (PROCESS_SUBSTITUTION)
9014c4
+  begin_unwind_frame ("saved_fifos");
9014c4
+  /* If we return, we longjmp and don't get a chance to restore the old
9014c4
+     fifo list, so we add an unwind protect to free it */
9014c4
   ofifo = num_fifos ();
9014c4
   ofifo_list = copy_fifo_list (&osize);
9014c4
+  if (ofifo_list)
9014c4
+    add_unwind_protect (xfree, ofifo_list);
9014c4
 #endif
9014c4
 
9014c4
   if (do_redirections (redirects, RX_ACTIVE|RX_UNDOABLE) != 0)
9014c4
@@ -5063,7 +5074,9 @@ execute_builtin_or_function (words, builtin, var, redirects,
9014c4
   nfifo = num_fifos ();
9014c4
   if (nfifo > ofifo)
9014c4
     close_new_fifos (ofifo_list, osize);
9014c4
-  free (ofifo_list);
9014c4
+  if (ofifo_list)
9014c4
+    free (ofifo_list);
9014c4
+  discard_unwind_frame ("saved_fifos");
9014c4
 #endif
9014c4
 
9014c4
   return (result);
9014c4
diff --git a/patchlevel.h b/patchlevel.h
9014c4
index 779671cd..09a3cc84 100644
9014c4
--- a/patchlevel.h
9014c4
+++ b/patchlevel.h
9014c4
@@ -25,6 +25,6 @@
9014c4
    regexp `^#define[ 	]*PATCHLEVEL', since that's what support/mkversion.sh
9014c4
    looks for to find the patch level (for the sccs version string). */
9014c4
 
9014c4
-#define PATCHLEVEL 13
9014c4
+#define PATCHLEVEL 14
9014c4
 
9014c4
 #endif /* _PATCHLEVEL_H_ */
9014c4
-- 
9014c4
2.13.6
9014c4