]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
thash: add debug validation check for use_cnt
authorVictor Julien <victor@inliniac.net>
Tue, 17 Aug 2021 12:07:17 +0000 (14:07 +0200)
committerPhilippe Antoine <contact@catenacyber.fr>
Fri, 24 Sep 2021 13:22:09 +0000 (15:22 +0200)
src/util-thash.c

index 9dba6cdbca0c32449d70e47a0f044c74e4738d39..a46a0e3f8e2d2b0ee2d1b72335886e4f064f2547 100644 (file)
@@ -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);
         }