Collin Funk <[email protected]> writes:

> Thanks, I pushed it with those changes [1].

Oops, tiny oversight. Forgot to call posix_spawnattr_destroy and
posix_spawn_file_actions_destroy when we successfully call posix_spawn.

I pushed the attached patch to fix that.

Collin

>From 2213542e400e2008e02f1b18232e17a3d7ab112e Mon Sep 17 00:00:00 2001
Message-ID: <2213542e400e2008e02f1b18232e17a3d7ab112e.1761248675.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Thu, 23 Oct 2025 12:35:37 -0700
Subject: [PATCH] split: cleanup after posix_spawn

* boostrap.conf (gnulib_modules): Add posix_spawn_file_actions_destroy.
* src/split.c (cleanup): Call posix_spawnattr_destroy and
posix_spawn_file_actions_destroy after a successful posix_spawn.
---
 bootstrap.conf | 1 +
 src/split.c    | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/bootstrap.conf b/bootstrap.conf
index fdab0725f..4d401d2eb 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -220,6 +220,7 @@ gnulib_modules="
   posix_spawnattr_setsigdefault
   posix_spawn_file_actions_addclose
   posix_spawn_file_actions_adddup2
+  posix_spawn_file_actions_destroy
   posix_spawn_file_actions_init
   posix_spawnp
   posixtm
diff --git a/src/split.c b/src/split.c
index 077e30f0d..3d1509113 100644
--- a/src/split.c
+++ b/src/split.c
@@ -561,6 +561,9 @@ create (char const *name)
         error (EXIT_FAILURE, errno, _("failed to run command: \"%s -c %s\""),
                shell_prog, filter_command);
 
+      posix_spawnattr_destroy (&attr);
+      posix_spawn_file_actions_destroy (&actions);
+
       if (close (fd_pair[0]) != 0)
         error (EXIT_FAILURE, errno, _("failed to close input pipe"));
       filter_pid = child_pid;
-- 
2.51.0

Reply via email to