udev,sysupdated: fix pidfd leak

Follow-up for 179dcf924f

After the mentioned commit, event_add_child_pidref() duplicates
the pidfd internally, hence the original pidfd would be leaked
with TAKE_PIDREF.
This commit is contained in:
Mike Yuan
2026-01-01 20:10:45 +01:00
committed by Yu Watanabe
parent 47d22e41e4
commit ca6b65991c
2 changed files with 1 additions and 6 deletions

View File

@@ -543,7 +543,7 @@ static int job_start(Job *j) {
r = sd_event_source_set_child_process_own(j->child, true);
if (r < 0)
return log_error_errno(r, "Event loop failed to take ownership of child process: %m");
TAKE_PIDREF(pid);
pidref_done(&pid); /* disarm sigkill_wait */
j->stdout_fd = TAKE_FD(stdout_fd);

View File

@@ -208,11 +208,6 @@ static int synthesize_change(Manager *manager, sd_device *dev) {
return 0;
}
r = sd_event_source_set_child_pidfd_own(s, true);
if (r < 0)
return r;
TAKE_PIDREF(pidref);
r = set_ensure_put(&manager->synthesize_change_child_event_sources, &event_source_hash_ops, s);
if (r < 0)
return r;