From 07c663a6c59a0571be9e407d10b9a82b46ecb578 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 8 Jul 2018 23:09:18 +0900 Subject: 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 #9505 and #9510. (cherry picked from commit 20d4ee2cbc21e0c4d2dd6c01d5a18a4cf0d98222) --- src/libelogind/sd-bus/bus-slot.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/libelogind') diff --git a/src/libelogind/sd-bus/bus-slot.c b/src/libelogind/sd-bus/bus-slot.c index fbf37320d..679006135 100644 --- a/src/libelogind/sd-bus/bus-slot.c +++ b/src/libelogind/sd-bus/bus-slot.c @@ -81,7 +81,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); } -- cgit v1.2.3