summaryrefslogtreecommitdiff
path: root/mesh/mesh.c
diff options
context:
space:
mode:
authorBrian Gix <brian.gix@intel.com>2019-12-03 13:04:10 -0800
committerBrian Gix <brian.gix@intel.com>2019-12-04 09:11:46 -0800
commit63b7276460482ccc8dfdb7c6aefd319950146622 (patch)
tree313cbada2cc3ddff38c03a3206fedd2ebc737110 /mesh/mesh.c
parent681b623c82616ba24e2eebc748a17786fb0cc3b2 (diff)
downloadbluez-63b7276460482ccc8dfdb7c6aefd319950146622.tar.gz
mesh: Fix memory leak in Join() API call
Diffstat (limited to 'mesh/mesh.c')
-rw-r--r--mesh/mesh.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/mesh/mesh.c b/mesh/mesh.c
index 55204da56..68cf0cd12 100644
--- a/mesh/mesh.c
+++ b/mesh/mesh.c
@@ -63,7 +63,7 @@ struct bt_mesh {
struct join_data{
struct l_dbus_message *msg;
struct mesh_agent *agent;
- const char *sender;
+ char *sender;
const char *app_path;
struct mesh_node *node;
uint32_t disc_watch;
@@ -218,6 +218,7 @@ static void free_pending_join_call(bool failed)
if (failed)
node_remove(join_pending->node);
+ l_free(join_pending->sender);
l_free(join_pending);
join_pending = NULL;
}
@@ -281,8 +282,10 @@ static void prov_disc_cb(struct l_dbus *bus, void *user_data)
if (!join_pending)
return;
- if (join_pending->msg)
+ if (join_pending->msg) {
l_dbus_message_unref(join_pending->msg);
+ join_pending->msg = NULL;
+ }
acceptor_cancel(&mesh);
join_pending->disc_watch = 0;