From: Victor Julien Date: Tue, 17 Aug 2021 12:07:17 +0000 (+0200) Subject: thash: add debug validation check for use_cnt X-Git-Tag: suricata-7.0.0-beta1~1361 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ef857e533869dd4ab1de978c8a57a025f371411;p=thirdparty%2Fsuricata.git thash: add debug validation check for use_cnt --- 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); }