when creating an interface, set magic before linking

set the magic number in a newly-created interface object
before appending it to mgr->interfaces in order to prevent
a possible assertion.
This commit is contained in:
Evan Hunt 2022-09-06 17:12:14 -07:00
parent 5267a25b17
commit 8c01662048

View file

@ -479,12 +479,12 @@ interface_create(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr, const char *name,
ISC_LINK_INIT(ifp, link);
ns_interfacemgr_attach(mgr, &ifp->mgr);
ifp->magic = IFACE_MAGIC;
LOCK(&mgr->lock);
ISC_LIST_APPEND(mgr->interfaces, ifp, link);
UNLOCK(&mgr->lock);
ifp->magic = IFACE_MAGIC;
*ifpret = ifp;
}