mesh: Fix segmentation fault when removing a node
PATCH v2 1/1 mesh: Fix segmentation fault when removing a node
This fixes a segmentation fault introduced by earlier changes. Segmentation fault was used by accessing a queu that has been destroyed, but the corresponding pointer hasn't been set to NULL.
--- mesh/node.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
mesh/node.c +5 -1
@@ -260,12 +260,16 @@ static void free_node_resources(void *data)/* Unregister io callbacks */ if (node->net)mesh_net_detach (node->net); +mesh_net_free (node->net); + node->net =NULL ;l_queue_destroy (node->elements, element_free); -l_free (node->comp); + node->elements =NULL ;free_node_dbus_resources (node); + +l_free (node->comp);l_free (node); }
Signature · 1 line
2.21.0
Applied with agreed upon minor adjustments, which have been build and run tested.
Quoted 29 lines · Inga Stotland
This fixes a segmentation fault introduced by earlier changes. Segmentation fault was used by accessing a queu that has been destroyed, but the corresponding pointer hasn't been set to NULL.
--- mesh/node.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)mesh/node.c +5
-1@@ -260,12 +260,16 @@ static void free_node_resources(void *data)/* Unregister io callbacks */ if (node->net)mesh_net_detach (node->net); +mesh_net_free (node->net); + node->net =NULL ;l_queue_destroy (node->elements, element_free); -l_free (node->comp); + node->elements =NULL ;free_node_dbus_resources (node); + +l_free (node->comp);l_free (node); }