From 16cd6e700e9145281fe58c1367e8cd533db99756 Mon Sep 17 00:00:00 2001 From: sam Date: Fri, 2 Apr 2004 23:47:39 +0000 Subject: [PATCH] cleanup descriptor allocation if attach fails Obtained from: madwifi --- sys/dev/ath/if_ath.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index 5c288e299e09..8f2cc8527f96 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -288,7 +288,7 @@ ath_attach(u_int16_t devid, struct ath_softc *sc) ); if (sc->sc_txhalq == (u_int) -1) { if_printf(ifp, "unable to setup a data xmit queue!\n"); - goto bad; + goto bad2; } sc->sc_bhalq = ath_hal_setuptxqueue(ah, HAL_TX_QUEUE_BEACON, @@ -296,7 +296,7 @@ ath_attach(u_int16_t devid, struct ath_softc *sc) ); if (sc->sc_bhalq == (u_int) -1) { if_printf(ifp, "unable to setup a beacon xmit queue!\n"); - goto bad; + goto bad2; } ifp->if_softc = sc; @@ -355,6 +355,8 @@ ath_attach(u_int16_t devid, struct ath_softc *sc) sc->sc_rx_th.wr_ihdr.it_present = htole32(ATH_RX_RADIOTAP_PRESENT); return 0; +bad2: + ath_desc_free(sc); bad: if (ah) ath_hal_detach(ah);