nalika / rpms / bash

Forked from rpms/bash 2 years ago
Clone

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

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