hostbits: release use_cnt for unix (add|remove)-hostbit

Commands would leave use_cnt incremented, never decrementing them. This
would lead to a asserting triggering at shutdown.

Bug: #7020.
pull/11076/head
Victor Julien 10 months ago committed by Victor Julien
parent bc2dfe4c17
commit d02c57bd1f

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

Loading…
Cancel
Save