mesh: Fix leaked message reference 25/235125/1
authorBrian Gix <brian.gix@intel.com>
Fri, 22 May 2020 19:50:32 +0000 (12:50 -0700)
committerAbhay Agarwal <ay.agarwal@samsung.com>
Thu, 28 May 2020 11:27:22 +0000 (16:57 +0530)
Change-Id: I5184625d2b6d443f44e6819c64f0b738bfdfa7ee
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
mesh/manager.c

index 2eb8605..d088842 100644 (file)
@@ -230,6 +230,7 @@ static void add_start(void *user_data, int err)
                                "Failed to start provisioning initiator");
 
        l_dbus_send(dbus_get_bus(), reply);
+       l_dbus_message_unref(add_pending->msg);
 
        add_pending->msg = NULL;
 }
@@ -266,7 +267,6 @@ static struct l_dbus_message *add_node_call(struct l_dbus *dbus,
        /* Invoke Prov Initiator */
 
        add_pending = l_new(struct add_data, 1);
-       add_pending->msg = l_dbus_message_ref(msg);
        memcpy(add_pending->uuid, uuid, 16);
        add_pending->node = node;
        add_pending->agent = node_get_agent(node);
@@ -279,6 +279,7 @@ static struct l_dbus_message *add_node_call(struct l_dbus *dbus,
                goto fail;
        }
 
+       add_pending->msg = l_dbus_message_ref(msg);
        initiator_start(PB_ADV, uuid, 99, 60, add_pending->agent, add_start,
                                add_data_get, add_cmplt, node, add_pending);