diff options
author | ru <ru@FreeBSD.org> | 2005-09-16 11:25:19 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2005-09-16 11:25:19 +0000 |
commit | ffd86537c18a9461b7ba5750e9c1614efab9e102 (patch) | |
tree | 28693ec03ccca1e33bd2724f25f53e25086d4948 /sys/dev/hatm | |
parent | c71407b5890e69c4a1adc0e0936f0d7e9cd24be4 (diff) | |
download | FreeBSD-src-ffd86537c18a9461b7ba5750e9c1614efab9e102.zip FreeBSD-src-ffd86537c18a9461b7ba5750e9c1614efab9e102.tar.gz |
Fix "struct ifnet" leaks when attach() fails in the middle.
Diffstat (limited to 'sys/dev/hatm')
-rw-r--r-- | sys/dev/hatm/if_hatm.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/hatm/if_hatm.c b/sys/dev/hatm/if_hatm.c index cd955ac..37263f5 100644 --- a/sys/dev/hatm/if_hatm.c +++ b/sys/dev/hatm/if_hatm.c @@ -497,6 +497,9 @@ hatm_destroy(struct hatm_softc *sc) cv_destroy(&sc->cv_rcclose); cv_destroy(&sc->vcc_cv); mtx_destroy(&sc->mtx); + + if (sc->ifp != NULL) + if_free(sc->ifp); } /* @@ -1631,7 +1634,6 @@ hatm_detach(device_t dev) mtx_unlock(&sc->mtx); atm_ifdetach(sc->ifp); - if_free(sc->ifp); hatm_destroy(sc); @@ -1655,8 +1657,7 @@ hatm_attach(device_t dev) ifp = sc->ifp = if_alloc(IFT_ATM); if (ifp == NULL) { device_printf(dev, "could not if_alloc()\n"); - error = ENOSPC; - goto failed; + return (ENOSPC); } sc->dev = dev; |