From 2ef857e533869dd4ab1de978c8a57a025f371411 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 17 Aug 2021 14:07:17 +0200 Subject: [PATCH] thash: add debug validation check for use_cnt --- src/util-thash.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util-thash.c b/src/util-thash.c index 9dba6cdbca..a46a0e3f8e 100644 --- a/src/util-thash.c +++ b/src/util-thash.c @@ -33,6 +33,7 @@ #include "util-byte.h" #include "util-hash-lookup3.h" +#include "util-validate.h" static THashData *THashGetUsed(THashTableContext *ctx); static void THashDataEnqueue (THashDataQueue *q, THashData *h); @@ -186,6 +187,8 @@ error: static void THashDataFree(THashTableContext *ctx, THashData *h) { if (h != NULL) { + DEBUG_VALIDATE_BUG_ON(SC_ATOMIC_GET(h->use_cnt) != 0); + if (h->data != NULL) { ctx->config.DataFree(h->data); }