From: Victor Julien Date: Wed, 22 Nov 2023 07:17:45 +0000 (+0100) Subject: host: fix minor coverity warning X-Git-Tag: suricata-8.0.0-beta1~2036 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f7e61ef61b6a3cc6e69d2f20992f4e386453981;p=thirdparty%2Fsuricata.git host: fix minor coverity warning CID 1554240: Data race undermines locking (LOCK_EVASION) --- diff --git a/src/host.c b/src/host.c index 7a5305ac18..37c0f4dad4 100644 --- a/src/host.c +++ b/src/host.c @@ -340,14 +340,11 @@ void HostShutdown(void) */ void HostCleanup(void) { - Host *h; - uint32_t u; - if (host_hash != NULL) { - for (u = 0; u < host_config.hash_size; u++) { - h = host_hash[u].head; + for (uint32_t u = 0; u < host_config.hash_size; u++) { HostHashRow *hb = &host_hash[u]; HRLOCK_LOCK(hb); + Host *h = host_hash[u].head; while (h) { if ((SC_ATOMIC_GET(h->use_cnt) > 0) && (h->iprep != NULL)) { /* iprep is attached to host only clear local storage */