nlm: only access refcounts using dedicated primitives

Sponsored by:	Rubicon Communications, LLC ("Netgate")
This commit is contained in:
Mateusz Guzik 2022-11-24 19:25:25 +00:00
parent 8288117a61
commit 3026214ed6

View File

@ -829,7 +829,7 @@ nlm_create_host(const char* caller_name)
if (!host) if (!host)
return (NULL); return (NULL);
mtx_init(&host->nh_lock, "nh_lock", NULL, MTX_DEF); mtx_init(&host->nh_lock, "nh_lock", NULL, MTX_DEF);
host->nh_refs = 1; refcount_init(&host->nh_refs, 1);
strlcpy(host->nh_caller_name, caller_name, MAXNAMELEN); strlcpy(host->nh_caller_name, caller_name, MAXNAMELEN);
host->nh_sysid = nlm_next_sysid++; host->nh_sysid = nlm_next_sysid++;
snprintf(host->nh_sysid_string, sizeof(host->nh_sysid_string), snprintf(host->nh_sysid_string, sizeof(host->nh_sysid_string),