]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-bus: unref slot->match_callback.install_slot when slot is disconnected
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 8 Jul 2018 14:09:18 +0000 (23:09 +0900)
committerLennart Poettering <lennart@poettering.net>
Fri, 13 Jul 2018 18:07:43 +0000 (20:07 +0200)
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 #9505 and #9510.

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

index 984322a320a51cd4d86d4449cd018905faeed722..17ea8f2ed1d17d1d6ca6935a2f6da7915f25b032 100644 (file)
@@ -79,7 +79,10 @@ void bus_slot_disconnect(sd_bus_slot *slot) {
                         (void) bus_remove_match_internal(slot->bus, slot->match_callback.match_string);
 
                 if (slot->match_callback.install_slot) {
-                        bus_slot_disconnect(slot->match_callback.install_slot);
+                        if (slot->match_callback.install_slot->bus) {
+                                bus_slot_disconnect(slot->match_callback.install_slot);
+                                sd_bus_slot_unref(slot->match_callback.install_slot);
+                        }
                         slot->match_callback.install_slot = sd_bus_slot_unref(slot->match_callback.install_slot);
                 }