]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
util/thash: decrease memuse if array was allocated 11445/head
authorPhilippe Antoine <pantoine@oisf.net>
Thu, 4 Jul 2024 11:55:27 +0000 (13:55 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 8 Jul 2024 08:36:22 +0000 (10:36 +0200)
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)

src/util-thash.c

index 6443990bc219f860cf5ac1dd3e6d9065b9a0a274..d9500e72622251e69dc855d7948fa4b9672dc599 100644 (file)
@@ -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;