diff options
author | Inga Stotland <inga.stotland@intel.com> | 2020-05-21 17:35:00 -0700 |
---|---|---|
committer | Abhay Agarwal <ay.agarwal@samsung.com> | 2020-05-28 16:57:22 +0530 |
commit | c8266f8a1022b33e4efbcac6add1ec45857dc091 (patch) | |
tree | 58276fa428bedb58b4420e36c130e415c845df45 | |
parent | 42ed9f94ea3b33df1d5e3ceec30f09ab36784a6c (diff) | |
download | bluez-c8266f8a1022b33e4efbcac6add1ec45857dc091.tar.gz bluez-c8266f8a1022b33e4efbcac6add1ec45857dc091.tar.bz2 bluez-c8266f8a1022b33e4efbcac6add1ec45857dc091.zip |
mesh: Fix memory leak in Create, Import & Attach methods
This ensures that every time l_dbus_message_ref() is used to preserve
a message for a pending method reply, there is a matching call to
l_dbus_message_unref().
Change-Id: I5c6846f9ab9ca11d23c7729933af0e2945d015c1
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
-rw-r--r-- | mesh/mesh.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mesh/mesh.c b/mesh/mesh.c index 65753934..6bf831a7 100644 --- a/mesh/mesh.c +++ b/mesh/mesh.c @@ -308,6 +308,7 @@ static void pending_request_exit(void *data) reply = dbus_error(msg, MESH_ERROR_FAILED, "Failed. Exiting"); l_dbus_send(dbus_get_bus(), reply); + l_dbus_message_unref(msg); } static void free_pending_join_call(bool failed) @@ -627,6 +628,7 @@ static void attach_ready_cb(void *user_data, int status, struct mesh_node *node) reply = dbus_error(pending_msg, status, "Attach failed"); l_dbus_send(dbus_get_bus(), reply); + l_dbus_message_unref(pending_msg); } static struct l_dbus_message *attach_call(struct l_dbus *dbus, @@ -699,6 +701,7 @@ static void create_node_ready_cb(void *user_data, int status, if (status != MESH_ERROR_NONE) { reply = dbus_error(pending_msg, status, NULL); l_dbus_send(dbus_get_bus(), reply); + l_dbus_message_unref(pending_msg); return; } @@ -718,6 +721,7 @@ static void create_node_ready_cb(void *user_data, int status, l_dbus_message_set_arguments(msg, "t", l_get_be64(token)); dbus_send_with_timeout(dbus, msg, create_join_complete_reply_cb, node, DEFAULT_DBUS_TIMEOUT); + l_dbus_message_unref(pending_msg); } static struct l_dbus_message *create_network_call(struct l_dbus *dbus, |