char* argv[],
const struct rlimit *saved_rlimit_nofile,
const struct rlimit *saved_rlimit_memlock,
- FDSet *fds,
+ FDSet *_fds, /* donated */
const char *switch_root_dir,
const char *switch_root_init,
uint64_t saved_capability_ambient_set,
assert(saved_rlimit_memlock);
assert(ret_error_message);
+ /* The fdset is donated to us, take ownership so it is freed on all exit paths. */
+ _cleanup_fdset_free_ FDSet *fds = TAKE_PTR(_fds);
+
/* Close and disarm the watchdog, so that the new instance can reinitialize it, but the machine
* doesn't get rebooted while we do that. */
watchdog_close(/* disarm= */ true);
argc, argv,
&saved_rlimit_nofile,
&saved_rlimit_memlock,
- fds,
+ TAKE_PTR(fds),
switch_root_dir,
switch_root_init,
saved_ambient_set,