Skip to contentSkip to conversation

dbus: Free instance only after all references removed

PATCH Applied Andrew Zaborowski 2 participants 2 messages Sep 27, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dbus: Free instance only after all references removed

In _dbus_object_tree_remove_interface move the freeing of the instance object to after we've dropped any queued Property Change and Interface Added/Removed records referring to that instance. We didn't really need the object around for that (only the pointer) but we want to be extra careful.

---
 ell/dbus-service.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
ell/dbus-service.c +2 -2
index c27ca84..43c7a5c 100644
@@ -1529,8 +1529,6 @@ bool _dbus_object_tree_remove_interface(struct _dbus_object_tree *tree,
 	if (!instance)
 		return false;
 
-	interface_instance_free(instance);
-
 	if (!strcmp(interface, L_DBUS_INTERFACE_OBJECT_MANAGER)) {
 		manager = l_queue_remove_if(tree->object_managers,
 						match_object_manager_path,
@@ -1591,6 +1589,8 @@ bool _dbus_object_tree_remove_interface(struct _dbus_object_tree *tree,
 	if (property_change_rec)
 		property_change_record_free(property_change_rec);
 
+	interface_instance_free(instance);
+
 	return true;
 }
 
Signature · 1 line
2.11.0
#1 lore raw

Hi Andrew,

Quoted 9 lines · Andrew Zaborowski

In _dbus_object_tree_remove_interface move the freeing of the instance object to after we've dropped any queued Property Change and Interface Added/Removed records referring to that instance. We didn't really need the object around for that (only the pointer) but we want to be extra careful.

---
  ell/dbus-service.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.

Regards,
-Denis