]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
hostbits: release use_cnt for unix (add|remove)-hostbit
authorVictor Julien <vjulien@oisf.net>
Tue, 14 May 2024 04:46:25 +0000 (06:46 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 15 May 2024 05:12:27 +0000 (07:12 +0200)
Commands would leave use_cnt incremented, never decrementing them. This
would lead to a asserting triggering at shutdown.

Bug: #7020.

src/runmode-unix-socket.c

index b611870f0d71ba7573a166d0a6f1eef81e6d8bd3..f82a9fdc1460df64211cdd8068f5776bf5958d14 100644 (file)
@@ -1279,7 +1279,7 @@ TmEcode UnixSocketHostbitAdd(json_t *cmd, json_t* answer, void *data_usused)
     Host *host = HostGetHostFromHash(&a);
     if (host) {
         HostBitSet(host, idx, SCTIME_SECS(current_time) + expire);
-        HostUnlock(host);
+        HostRelease(host);
 
         json_object_set_new(answer, "message", json_string("hostbit added"));
         return TM_ECODE_OK;
@@ -1348,7 +1348,7 @@ TmEcode UnixSocketHostbitRemove(json_t *cmd, json_t* answer, void *data_unused)
     Host *host = HostLookupHostFromHash(&a);
     if (host) {
         HostBitUnset(host, idx);
-        HostUnlock(host);
+        HostRelease(host);
         json_object_set_new(answer, "message", json_string("hostbit removed"));
         return TM_ECODE_OK;
     } else {
@@ -1425,7 +1425,7 @@ TmEcode UnixSocketHostbitList(json_t *cmd, json_t* answer, void *data_unused)
         bits[use].expire = iter->expire;
         use++;
     }
-    HostUnlock(host);
+    HostRelease(host);
 
     json_t *jdata = json_object();
     json_t *jarray = json_array();