From 4b93349e9dcf5eba94944650d5a78370fd5c2f9b Mon Sep 17 00:00:00 2001 From: David Barksdale Date: Mon, 5 Sep 2016 01:59:35 +0000 Subject: [PATCH] Fix UAF detected by asan --- src/namestore/gnunet-service-namestore.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index 05bcd94ce..effb33e51 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c @@ -340,13 +340,6 @@ client_disconnect_notification (void *cls, client); if (NULL == (nc = GNUNET_SERVER_client_get_user_context (client, struct NamestoreClient))) return; - while (NULL != (no = nc->op_head)) - { - GNUNET_CONTAINER_DLL_remove (nc->op_head, nc->op_tail, no); - GNUNET_free (no); - } - GNUNET_CONTAINER_DLL_remove (client_head, client_tail, nc); - GNUNET_free (nc); for (zm = monitor_head; NULL != zm; zm = zm->next) { if (client == zm->nc->client) @@ -363,6 +356,13 @@ client_disconnect_notification (void *cls, break; } } + while (NULL != (no = nc->op_head)) + { + GNUNET_CONTAINER_DLL_remove (nc->op_head, nc->op_tail, no); + GNUNET_free (no); + } + GNUNET_CONTAINER_DLL_remove (client_head, client_tail, nc); + GNUNET_free (nc); for (cop = cop_head; NULL != cop; cop = cop->next) if (client == cop->client) cop->client = NULL; -- 2.25.1