[PATCH BlueZ 1/2] mesh: Unreference pending D-Bus messages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This change results in proper cleanup of D-Bus messages for pending
replies: if l_dbus_message_ref() was called for a message, then
l_dbus_message_unref() must be called for the same message to completely
free the message resources.
---
 mesh/mesh.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/mesh/mesh.c b/mesh/mesh.c
index 231a6bca4..bed8484f2 100644
--- a/mesh/mesh.c
+++ b/mesh/mesh.c
@@ -354,6 +354,9 @@ static void free_pending_join_call(bool failed)
 
 	mesh_agent_remove(join_pending->agent);
 
+	if (join_pending->msg)
+		l_dbus_message_unref(join_pending->msg);
+
 	if (failed)
 		node_remove(join_pending->node);
 
@@ -422,9 +425,6 @@ static void prov_disc_cb(struct l_dbus *bus, void *user_data)
 	if (!join_pending)
 		return;
 
-	if (join_pending->msg)
-		l_dbus_message_unref(join_pending->msg);
-
 	acceptor_cancel(&mesh);
 	join_pending->disc_watch = 0;
 
@@ -650,6 +650,7 @@ static void attach_ready_cb(void *user_data, int status, struct mesh_node *node)
 
 done:
 	l_dbus_send(dbus_get_bus(), reply);
+	l_dbus_message_unref(pending_msg);
 	l_queue_remove(pending_queue, pending_msg);
 }
 
@@ -727,6 +728,7 @@ static void create_network_ready_cb(void *user_data, int status,
 
 done:
 	l_dbus_send(dbus_get_bus(), reply);
+	l_dbus_message_unref(pending_msg);
 	l_queue_remove(pending_queue, pending_msg);
 }
 
-- 
2.21.0




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux