From dfeff66499e4e116e6debae765410eba9ba46d51 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 7 Feb 2018 22:40:41 +0100 Subject: [PATCH] bus: when destroying a bus, also destroy per-unit bus track objects associated with it Let's not keep the old bus object pinned this way, let's destroy all relevant trackers for units, the way we already destroy them for jobs. --- src/core/dbus.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/dbus.c b/src/core/dbus.c index 5e6dd0dee56..c7c96a34098 100644 --- a/src/core/dbus.c +++ b/src/core/dbus.c @@ -1087,6 +1087,10 @@ static void destroy_bus(Manager *m, sd_bus **bus) { if (j->bus_track && sd_bus_track_get_bus(j->bus_track) == *bus) j->bus_track = sd_bus_track_unref(j->bus_track); + HASHMAP_FOREACH(u, m->units, i) + if (u->bus_track && sd_bus_track_get_bus(u->bus_track) == *bus) + u->bus_track = sd_bus_track_unref(u->bus_track); + /* Get rid of queued message on this bus */ if (m->queued_message && sd_bus_message_get_bus(m->queued_message) == *bus) m->queued_message = sd_bus_message_unref(m->queued_message); -- 2.47.3