posix_spawn_file_actions_destroy: Fix a crash (bug from 2019-06-10).
authorBruno Haible <bruno@clisp.org>
Tue, 28 Apr 2020 10:29:04 +0000 (12:29 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 28 Apr 2020 10:29:04 +0000 (12:29 +0200)
* lib/spawn_faction_destroy.c (posix_spawn_file_actions_destroy): Don't
access elements of the wrong union member.

ChangeLog
lib/spawn_faction_destroy.c

index 48bada33a07f50e81e6b028d7e1cbfbe312a2d0e..438874067e59eb6d908137c4ad6e93265bc11dfa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-04-28  Bruno Haible  <bruno@clisp.org>
+
+       posix_spawn_file_actions_destroy: Fix a crash (bug from 2019-06-10).
+       * lib/spawn_faction_destroy.c (posix_spawn_file_actions_destroy): Don't
+       access elements of the wrong union member.
+
 2020-04-27  Bruno Haible  <bruno@clisp.org>
 
        getdate: Remove deprecated module.
index 906797b039aa964bca60c60be1823e449349dabe..e9985f4a0d4aed57401857c4fc6501e43472bc57 100644 (file)
@@ -42,9 +42,11 @@ posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *file_actions)
       switch (sa->tag)
         {
         case spawn_do_open:
-        case spawn_do_chdir:
           free (sa->action.open_action.path);
           break;
+        case spawn_do_chdir:
+          free (sa->action.chdir_action.path);
+          break;
         default:
           /* No cleanup required.  */
           break;