diff mbox series

[BlueZ] mesh: Clear node's agent pointer after agent removal

Message ID 20210211025558.11791-1-inga.stotland@intel.com
State New
Headers show
Series [BlueZ] mesh: Clear node's agent pointer after agent removal | expand

Commit Message

Inga Stotland Feb. 11, 2021, 2:55 a.m. UTC
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.
---
 mesh/node.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Brian Gix Feb. 11, 2021, 3:04 a.m. UTC | #1
Applied high priority patch.

On Wed, 2021-02-10 at 18:55 -0800, Inga Stotland wrote:
> 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.

> ---

>  mesh/node.c | 1 +

>  1 file changed, 1 insertion(+)

> 

> diff --git a/mesh/node.c b/mesh/node.c

> index 4bc11309b..e81aa82fe 100644

> --- a/mesh/node.c

> +++ b/mesh/node.c

> @@ -2321,6 +2321,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;

>
diff mbox series

Patch

diff --git a/mesh/node.c b/mesh/node.c
index 4bc11309b..e81aa82fe 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -2321,6 +2321,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;