summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2006-10-11 19:20:47 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2006-10-11 19:20:47 +0000
commitd024343c8aa33665cebe9cffb0ca9cbfbd7922b1 (patch)
tree4faf33a002f214706310ef4e4bf1afb860ed97e1
parent9045f56ac486d0a0c9c083089ff1cc238df22311 (diff)
fix a potential null deref and a memleak (both in error path).
ok mglocker@
-rw-r--r--sys/dev/ic/pgt.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/dev/ic/pgt.c b/sys/dev/ic/pgt.c
index 0369d13a7d1..53970f70fff 100644
--- a/sys/dev/ic/pgt.c
+++ b/sys/dev/ic/pgt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pgt.c,v 1.34 2006/10/11 10:20:31 claudio Exp $ */
+/* $OpenBSD: pgt.c,v 1.35 2006/10/11 19:20:46 damien Exp $ */
/*
* Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org>
@@ -1814,10 +1814,10 @@ pgt_ieee80211_node_alloc(struct ieee80211com *ic)
struct pgt_ieee80211_node *pin;
pin = malloc(sizeof(*pin), M_DEVBUF, M_NOWAIT);
- bzero(pin, sizeof *pin);
- if (pin != NULL)
+ if (pin != NULL) {
+ bzero(pin, sizeof *pin);
pin->pin_dot1x_auth = PIN_DOT1X_UNAUTHORIZED;
-
+ }
return (struct ieee80211_node *)pin;
}
@@ -3201,6 +3201,7 @@ pgt_dma_alloc_queue(struct pgt_softc *sc, enum pgt_queue pq)
if (error != 0) {
printf("%s: can not create DMA tag for fragment\n",
sc->sc_dev.dv_xname);
+ free(pd, M_DEVBUF);
break;
}