From: Yu Watanabe Date: Sun, 8 May 2022 15:56:05 +0000 (+0900) Subject: core/unit: fix use-after-free X-Git-Tag: v251-rc3~40 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=734582830b58e000a26e18807ea277c18778573c;p=thirdparty%2Fsystemd.git core/unit: fix use-after-free Fixes #23312. --- diff --git a/src/core/unit.c b/src/core/unit.c index 42ee8892a4f..fcfc9bc8d2b 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -684,8 +684,8 @@ Unit* unit_free(Unit *u) { unit_dequeue_rewatch_pids(u); - sd_bus_slot_unref(u->match_bus_slot); - sd_bus_track_unref(u->bus_track); + u->match_bus_slot = sd_bus_slot_unref(u->match_bus_slot); + u->bus_track = sd_bus_track_unref(u->bus_track); u->deserialized_refs = strv_free(u->deserialized_refs); u->pending_freezer_message = sd_bus_message_unref(u->pending_freezer_message);