Move the lock init until after if_alloc in case the allocation fails and we
free the softc and return. MFC after: 3 days
This commit is contained in:
parent
6bfc799ccf
commit
9c68675bae
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=166916
@ -532,13 +532,13 @@ bridge_clone_create(struct if_clone *ifc, int unit, caddr_t params)
|
||||
int retry;
|
||||
|
||||
sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO);
|
||||
BRIDGE_LOCK_INIT(sc);
|
||||
ifp = sc->sc_ifp = if_alloc(IFT_ETHER);
|
||||
if (ifp == NULL) {
|
||||
free(sc, M_DEVBUF);
|
||||
return (ENOSPC);
|
||||
}
|
||||
|
||||
BRIDGE_LOCK_INIT(sc);
|
||||
sc->sc_brtmax = BRIDGE_RTABLE_MAX;
|
||||
sc->sc_brttimeout = BRIDGE_RTABLE_TIMEOUT;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user