Skip to content

Commit 20d4ee2

Browse files
yuwatapoettering
authored andcommitted
sd-bus: unref slot->match_callback.install_slot when slot is disconnected
When a slot is disconnected, then slot->match_callback.install_slot is also disconnected. So, bus_slot_disconnect() removes the install_slot from the list of slots in bus, although it is a floating object. This makes install_slot unreffed from bus when it is disconnected. Fixes systemd#9505 and systemd#9510.
1 parent 8840c47 commit 20d4ee2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/libsystemd/sd-bus/bus-slot.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ void bus_slot_disconnect(sd_bus_slot *slot) {
7979
(void) bus_remove_match_internal(slot->bus, slot->match_callback.match_string);
8080

8181
if (slot->match_callback.install_slot) {
82-
bus_slot_disconnect(slot->match_callback.install_slot);
82+
if (slot->match_callback.install_slot->bus) {
83+
bus_slot_disconnect(slot->match_callback.install_slot);
84+
sd_bus_slot_unref(slot->match_callback.install_slot);
85+
}
8386
slot->match_callback.install_slot = sd_bus_slot_unref(slot->match_callback.install_slot);
8487
}
8588

0 commit comments

Comments
 (0)