summaryrefslogtreecommitdiffstats
path: root/sys/dev/ti/if_ti.c
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2005-03-31 17:16:40 +0000
committerscottl <scottl@FreeBSD.org>2005-03-31 17:16:40 +0000
commitea294a1122158d12d35eed1e8fc98208c8ad7945 (patch)
tree4ac66294954b8d9ed7f81b3058e7c5032d0c4c32 /sys/dev/ti/if_ti.c
parent42821ae3c25cf2a9a3d6c7ed847f921e2e9918ed (diff)
downloadFreeBSD-src-ea294a1122158d12d35eed1e8fc98208c8ad7945.zip
FreeBSD-src-ea294a1122158d12d35eed1e8fc98208c8ad7945.tar.gz
If resource allocation fails, we could wind up freeing the cdev without it
being allocated. Add a simple check for this. Submitted by: yongari
Diffstat (limited to 'sys/dev/ti/if_ti.c')
-rw-r--r--sys/dev/ti/if_ti.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c
index 56e2207..86cea7c 100644
--- a/sys/dev/ti/if_ti.c
+++ b/sys/dev/ti/if_ti.c
@@ -2311,7 +2311,8 @@ ti_detach(dev)
struct ifnet *ifp;
sc = device_get_softc(dev);
- destroy_dev(sc->dev);
+ if (sc->dev)
+ destroy_dev(sc->dev);
KASSERT(mtx_initialized(&sc->ti_mtx), ("ti mutex not initialized"));
TI_LOCK(sc);
ifp = &sc->arpcom.ac_if;
OpenPOWER on IntegriCloud