From 942b52ea891833b0c79880f428f1619d2cceb43d Mon Sep 17 00:00:00 2001 From: ulfvonbelow Date: Sun, 29 Jan 2023 05:37:34 -0600 Subject: [PATCH] SETU: don't leak Operation.{message_control_flow,inquiries_sent}. --- src/setu/gnunet-service-setu.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c index 339d347f8..ba32af577 100644 --- a/src/setu/gnunet-service-setu.c +++ b/src/setu/gnunet-service-setu.c @@ -1552,6 +1552,16 @@ check_byzantine_bounds (struct Operation *op) } +static enum GNUNET_GenericReturnValue +free_values_iter(void *cls, + const struct GNUNET_HashCode *key, + void *value) +{ + GNUNET_free (value); + return GNUNET_YES; +} + + /* FIXME: the destroy logic is a mess and should be cleaned up! */ /** @@ -1605,6 +1615,19 @@ _GSS_operation_destroy (struct Operation *op) GNUNET_CONTAINER_multihashmap32_destroy (op->key_to_element); op->key_to_element = NULL; } + if (NULL != op->message_control_flow) + { + GNUNET_CONTAINER_multihashmap_iterate (op->message_control_flow, + &free_values_iter, + NULL); + GNUNET_CONTAINER_multihashmap_destroy (op->message_control_flow); + op->message_control_flow = NULL; + } + if (NULL != op->inquiries_sent) + { + GNUNET_CONTAINER_multihashmap_destroy (op->inquiries_sent); + op->inquiries_sent = NULL; + } if (NULL != set) { GNUNET_CONTAINER_DLL_remove (set->ops_head, -- 2.38.1