From: Philippe Antoine Date: Thu, 4 Jul 2024 11:55:27 +0000 (+0200) Subject: util/thash: decrease memuse if array was allocated X-Git-Tag: suricata-8.0.0-beta1~1055 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11431%2Fhead;p=thirdparty%2Fsuricata.git 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 --- 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);