chiark / gitweb /
sd-bus: when disconnecting a slot, also reset its memory
authorLennart Poettering <lennart@poettering.net>
Mon, 18 Dec 2017 20:58:14 +0000 (21:58 +0100)
committerSven Eden <yamakuzure@gmx.net>
Wed, 30 May 2018 05:49:58 +0000 (07:49 +0200)
Yes, we aren#t accessing this anymore after, but it's still nicer if
this is actually guaranteed.

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

index f7c9bfdf65d438bf29e16a4b3949127ed5f396d6..9a563717152a8f99118ae3a1ea7640b161fe1c80 100644 (file)
@@ -104,7 +104,7 @@ void bus_slot_disconnect(sd_bus_slot *slot) {
                 slot->bus->match_callbacks_modified = true;
                 bus_match_remove(&slot->bus->match_callbacks, &slot->match_callback);
 
-                free(slot->match_callback.match_string);
+                slot->match_callback.match_string = mfree(slot->match_callback.match_string);
 
                 break;
 
@@ -179,7 +179,7 @@ void bus_slot_disconnect(sd_bus_slot *slot) {
                         }
                 }
 
-                free(slot->node_vtable.interface);
+                slot->node_vtable.interface = mfree(slot->node_vtable.interface);
 
                 if (slot->node_vtable.node) {
                         LIST_REMOVE(vtables, slot->node_vtable.node->vtables, &slot->node_vtable);