]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
ippair: fix minor coverity warning
authorVictor Julien <vjulien@oisf.net>
Wed, 22 Nov 2023 07:21:23 +0000 (08:21 +0100)
committerVictor Julien <victor@inliniac.net>
Fri, 24 Nov 2023 10:57:11 +0000 (11:57 +0100)
CID 1554232:  Data race undermines locking  (LOCK_EVASION)

Ticket #6565.

src/ippair.c

index 81362f63f4c908a828aa6bcb6b1622313975b66a..b06f3d164414f106bb8283ee0df16c505e2a057e 100644 (file)
@@ -338,14 +338,11 @@ void IPPairShutdown(void)
  */
 void IPPairCleanup(void)
 {
-    IPPair *h;
-    uint32_t u;
-
     if (ippair_hash != NULL) {
-        for (u = 0; u < ippair_config.hash_size; u++) {
-            h = ippair_hash[u].head;
+        for (uint32_t u = 0; u < ippair_config.hash_size; u++) {
             IPPairHashRow *hb = &ippair_hash[u];
             HRLOCK_LOCK(hb);
+            IPPair *h = ippair_hash[u].head;
             while (h) {
                 if ((SC_ATOMIC_GET(h->use_cnt) > 0)) {
                     /* iprep is attached to ippair only clear local storage */