fix some memory leaks triggered by memory allocation errors, which were most visible in ath_mgtstart

git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3346 0192ed92-7a03-0410-a25b-9323aeb14dbd
This commit is contained in:
nbd 2008-02-08 05:38:41 +00:00
parent c3365b93bf
commit 625d3f967d
1 changed files with 10 additions and 7 deletions

View File

@ -3255,17 +3255,18 @@ ath_hardstart(struct sk_buff *skb, struct net_device *dev)
* without affecting any other bridge ports. */
if (skb_cloned(skb)) {
/* Remember the original SKB so we can free up our references */
struct sk_buff *skb_orig = skb;
skb = skb_copy(skb, GFP_ATOMIC);
if (skb == NULL) {
struct sk_buff *skb_new;
skb_new = skb_copy(skb, GFP_ATOMIC);
if (skb_new == NULL) {
DPRINTF(sc, ATH_DEBUG_XMIT,
"Dropping; skb_copy failure.\n");
/* No free RAM, do not requeue! */
goto hardstart_fail;
}
ieee80211_skb_copy_noderef(skb_orig, skb);
ieee80211_dev_kfree_skb(&skb_orig);
}
ieee80211_skb_copy_noderef(skb, skb_new);
ieee80211_dev_kfree_skb(&skb);
skb = skb_new;
}
eh = (struct ether_header *)skb->data;
#ifdef ATH_SUPERG_FF
@ -3531,11 +3532,13 @@ ath_mgtstart(struct ieee80211com *ic, struct sk_buff *skb)
*/
error = ath_tx_start(dev, SKB_CB(skb)->ni, bf, skb, 0);
if (error)
goto bad;
return error;
sc->sc_stats.ast_tx_mgmt++;
return 0;
bad:
if (skb)
ieee80211_dev_kfree_skb(&skb);
ath_return_txbuf(sc, &bf);
return error;
}