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-7.0.7~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9dbc565d96c121ec8356de42624aae7998dca9f;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 (cherry picked from commit eeec609ac822a9d3ffc407428d6e6a75f4e30afa) --- diff --git a/src/util-thash.c b/src/util-thash.c index 6443990bc2..d9500e7262 100644 --- a/src/util-thash.c +++ b/src/util-thash.c @@ -368,8 +368,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); SCFree(ctx); return;