summaryrefslogtreecommitdiffstats
path: root/src/core/execute.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-10-18 12:12:30 +0200
committerLennart Poettering <lennart@poettering.net>2023-10-18 13:52:17 +0200
commit26f937e5764a7eadf8f2dfd9a0b7868642ec5464 (patch)
tree754038224f34126ee9b0866117579d44968b80f5 /src/core/execute.c
parentserialize: add serialize_fd_many() helper (diff)
downloadsystemd-26f937e5764a7eadf8f2dfd9a0b7868642ec5464.tar.xz
systemd-26f937e5764a7eadf8f2dfd9a0b7868642ec5464.zip
execute: use close_many_and_free() more
Diffstat (limited to '')
-rw-r--r--src/core/execute.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/execute.c b/src/core/execute.c
index d9c8a19c38..ce947a7a52 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -2260,9 +2260,10 @@ void exec_params_serialized_done(ExecParameters *p) {
p->received_credentials_directory = mfree(p->received_credentials_directory);
p->received_encrypted_credentials_directory = mfree(p->received_encrypted_credentials_directory);
- for (size_t i = 0; p->idle_pipe && i < 4; i++)
- p->idle_pipe[i] = safe_close(p->idle_pipe[i]);
- p->idle_pipe = mfree(p->idle_pipe);
+ if (p->idle_pipe) {
+ close_many_and_free(p->idle_pipe, 4);
+ p->idle_pipe = NULL;
+ }
p->stdin_fd = safe_close(p->stdin_fd);
p->stdout_fd = safe_close(p->stdout_fd);