From cf7d8a23325784ffc1fc48aa11171e3068c3ace5 Mon Sep 17 00:00:00 2001 From: Inga Stotland Date: Thu, 4 Jul 2019 10:36:06 -0700 Subject: [PATCH] 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, 4 insertions(+), 2 deletions(-) diff --git a/mesh/node.c b/mesh/node.c index 88bd4764b..1f781cfe9 100644 --- a/mesh/node.c +++ b/mesh/node.c @@ -260,12 +260,14 @@ static void free_node_resources(void *data) /* Unregister io callbacks */ if (node->net) mesh_net_detach(node->net); - mesh_net_free(node->net); l_queue_destroy(node->elements, element_free); - l_free(node->comp); + node->elements = NULL; free_node_dbus_resources(node); + + mesh_net_free(node->net); + l_free(node->comp); l_free(node); } -- 2.47.3