Skip to content

Commit

Permalink
util/thash: decrease memuse if array was allocated
Browse files Browse the repository at this point in the history
THashInitConfig may not allocate array and increase memuse.
Such a failure leads to THashShutdown which should not decrease
the memuse.

Ticket: 7135
  • Loading branch information
catenacyber authored and victorjulien committed Jul 4, 2024
1 parent 35dffc6 commit eeec609
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/util-thash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit eeec609

Please sign in to comment.