2019-04-18 04:33:35

by Stotland, Inga

[permalink] [raw]
Subject: [PATCH BlueZ] mesh: Fix the cleanup of failed Join call

This fixes the accidental swap of conditional checks: on failure,
remove agent info if agent is registered and remove temporary node,
if one has been created.
---
mesh/node.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mesh/node.c b/mesh/node.c
index dae9a4b79..5431a9e9c 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -1474,10 +1474,10 @@ static void get_managed_objects_join_cb(struct l_dbus_message *msg,
return;
fail:
if (agent)
- free_node_resources(node);
+ mesh_agent_remove(agent);

if (node)
- mesh_agent_remove(agent);
+ free_node_resources(node);

req->cb(NULL, NULL);
}
--
2.17.2