From eeec609ac822a9d3ffc407428d6e6a75f4e30afa Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Thu, 4 Jul 2024 13:55:27 +0200 Subject: [PATCH] util/thash: decrease memuse if array was allocated THashInitConfig may not allocate array and increase memuse. Such a failure leads to THashShutdown which should not decrease the memuse. Ticket: 7135 --- src/util-thash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util-thash.c b/src/util-thash.c index 649d8b98b8..74c74e245a 100644 --- a/src/util-thash.c +++ b/src/util-thash.c @@ -378,8 +378,8 @@ void THashShutdown(THashTableContext *ctx) } SCFreeAligned(ctx->array); ctx->array = NULL; + (void)SC_ATOMIC_SUB(ctx->memuse, ctx->config.hash_size * sizeof(THashHashRow)); } - (void) SC_ATOMIC_SUB(ctx->memuse, ctx->config.hash_size * sizeof(THashHashRow)); THashDataQueueDestroy(&ctx->spare_q); DEBUG_VALIDATE_BUG_ON(SC_ATOMIC_GET(ctx->memuse) != 0); SCFree(ctx);