From: David Barksdale Date: Mon, 5 Sep 2016 01:59:35 +0000 (+0000) Subject: Fix UAF detected by asan X-Git-Tag: initial-import-from-subversion-38251~293 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4b93349e9dcf5eba94944650d5a78370fd5c2f9b;p=oweals%2Fgnunet.git Fix UAF detected by asan --- 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;