1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-13 00:58:27 +03:00

systemctl: fix memleak

Fixes a bug introduced by adb6cd9be2b7e9e614d2b5835c7b70cf8eacc852.

Fixes #36178.
This commit is contained in:
Yu Watanabe 2025-01-27 04:17:27 +09:00 committed by Luca Boccassi
parent 385ba2a3a3
commit 08570f2841

View File

@ -66,6 +66,10 @@ int verb_is_system_running(int argc, char *argv[], void *userdata) {
}
if (arg_wait && STR_IN_SET(state, "initializing", "starting")) {
/* The signal handler will allocate memory and assign to 'state', hence need to free previous
* one before entering the event loop. */
state = mfree(state);
r = sd_event_loop(event);
if (r < 0) {
log_warning_errno(r, "Failed to get property from event loop: %m");
@ -73,6 +77,8 @@ int verb_is_system_running(int argc, char *argv[], void *userdata) {
puts("unknown");
return EXIT_FAILURE;
}
assert(state);
}
if (!arg_quiet)