summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2015-08-06 12:53:06 +0200
committerDaniel Mack <daniel@zonque.org>2015-08-06 12:56:15 +0200
commitcf9fd50884bcd2fd3a54e0e0c0c83a7b3326ca9b (patch)
tree1610a9800fcbae283994d4d240e41b0dc939804d /src
parent5df0997459fef2a3d3e15fcb1f4aa8d0643231aa (diff)
core: unit: remove bus slot after calling unit_done()
The ->done callback in the unit's vtable might call into unit_unwatch_bus_name() and corrupt memory by that. Move the call down, and clean up the bus slot in case it hasn't been done yet.
Diffstat (limited to 'src')
-rw-r--r--src/core/unit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index 6cc5824eb2..43a5ca1064 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -478,11 +478,12 @@ void unit_free(Unit *u) {
if (u->manager->n_reloading <= 0)
unit_remove_transient(u);
- sd_bus_slot_unref(u->match_bus_slot);
bus_unit_send_removed_signal(u);
unit_done(u);
+ sd_bus_slot_unref(u->match_bus_slot);
+
unit_free_requires_mounts_for(u);
SET_FOREACH(t, u->names, i)