summaryrefslogtreecommitdiffstats
path: root/sys/dev/hatm
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2005-09-16 11:25:19 +0000
committerru <ru@FreeBSD.org>2005-09-16 11:25:19 +0000
commitffd86537c18a9461b7ba5750e9c1614efab9e102 (patch)
tree28693ec03ccca1e33bd2724f25f53e25086d4948 /sys/dev/hatm
parentc71407b5890e69c4a1adc0e0936f0d7e9cd24be4 (diff)
downloadFreeBSD-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.c7
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;
OpenPOWER on IntegriCloud