From b3ddcd0dbb6cf0db09f7bd156d73b3cb8e284e2d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 27 Aug 2021 14:58:46 +0200 Subject: -fix misc. memory leaks --- src/backend/anastasis-httpd_truth.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'src/backend/anastasis-httpd_truth.c') diff --git a/src/backend/anastasis-httpd_truth.c b/src/backend/anastasis-httpd_truth.c index aa3011b..df105dd 100644 --- a/src/backend/anastasis-httpd_truth.c +++ b/src/backend/anastasis-httpd_truth.c @@ -229,11 +229,6 @@ static struct GetContext *gc_head; */ static struct GetContext *gc_tail; -/** - * Heap for processing timeouts of requests. - */ -static struct GNUNET_CONTAINER_Heap *to_heap; - /** * Task running #do_timeout(). */ @@ -253,7 +248,7 @@ do_timeout (void *cls) (void) cls; to_task = NULL; while (NULL != - (gc = GNUNET_CONTAINER_heap_peek (to_heap))) + (gc = GNUNET_CONTAINER_heap_peek (AH_to_heap))) { if (GNUNET_TIME_absolute_is_future (gc->timeout)) break; @@ -269,7 +264,7 @@ do_timeout (void *cls) GNUNET_assert (NULL != gc->hn); gc->hn = NULL; GNUNET_assert (gc == - GNUNET_CONTAINER_heap_remove_root (to_heap)); + GNUNET_CONTAINER_heap_remove_root (AH_to_heap)); } if (NULL == gc) return; @@ -336,11 +331,6 @@ AH_truth_shutdown (void) GNUNET_SCHEDULER_cancel (to_task); to_task = NULL; } - if (NULL != to_heap) - { - GNUNET_CONTAINER_heap_destroy (to_heap); - to_heap = NULL; - } } @@ -931,10 +921,10 @@ run_authorization_process (struct MHD_Connection *connection, return MHD_YES; case ANASTASIS_AUTHORIZATION_RES_SUSPENDED: /* connection was suspended */ - if (NULL == to_heap) - to_heap = GNUNET_CONTAINER_heap_create ( + if (NULL == AH_to_heap) + AH_to_heap = GNUNET_CONTAINER_heap_create ( GNUNET_CONTAINER_HEAP_ORDER_MIN); - gc->hn = GNUNET_CONTAINER_heap_insert (to_heap, + gc->hn = GNUNET_CONTAINER_heap_insert (AH_to_heap, gc, gc->timeout.abs_value_us); gc->suspended = true; @@ -946,7 +936,7 @@ run_authorization_process (struct MHD_Connection *connection, { struct GetContext *rn; - rn = GNUNET_CONTAINER_heap_peek (to_heap); + rn = GNUNET_CONTAINER_heap_peek (AH_to_heap); to_task = GNUNET_SCHEDULER_add_at (rn->timeout, &do_timeout, NULL); -- cgit v1.2.3