rcolebaugh / rpms / bash

Forked from rpms/bash a year ago
Clone

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

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