mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-15 16:24:28 +08:00
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().
This commit is contained in:
parent
7a5007178f
commit
9dd9cba0a2
@ -309,6 +309,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)
|
||||
@ -628,6 +629,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,
|
||||
@ -700,6 +702,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;
|
||||
}
|
||||
|
||||
@ -719,6 +722,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,
|
||||
|
Loading…
Reference in New Issue
Block a user