mesh: Clear node's agent pointer after agent removal
authorInga Stotland <inga.stotland@intel.com>
Thu, 11 Feb 2021 02:55:58 +0000 (18:55 -0800)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:34 +0000 (19:08 +0530)
When a node is created/provisioned/imported, the new node's agent
is removed. The corresponding pointer in the node structure needs
to be set to NULL to avoid pointing to freed memory.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
mesh/node.c

index 0cca4c8..f00a877 100644 (file)
@@ -2342,6 +2342,7 @@ void node_finalize_new_node(struct mesh_node *node, struct mesh_io *io)
 
        free_node_dbus_resources(node);
        mesh_agent_remove(node->agent);
+       node->agent = NULL;
 
        node->busy = false;