Skip to contentSkip to conversation

mwifiex: add a kfree() to an error path

PATCH In review Dan Carpenter 2 participants 2 messages Sep 21, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mwifiex: add a kfree() to an error path

We're not likely to hit this small memory leak, but lets fix it anyway to keep the static checkers happy.

drivers/net/wireless/mwifiex/sta_ioctl.c +1 -0
index eb569fa..215c65a 100644
@@ -203,6 +203,7 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
 		beacon_ie = kmemdup(bss->information_elements,
 					bss->len_beacon_ies, GFP_KERNEL);
 		if (!beacon_ie) {
+			kfree(bss_desc);
 			dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n");
 			return -ENOMEM;
 		}
Acked-by on v1 1/2
#1 lore raw

Hi Dan,

Thanks for the patch.

Quoted 11 lines

-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Wednesday, September 21, 2011 12:13 AM
To: Bing Zhao
Cc: John W. Linville; [email protected]; [email protected]
Subject: [patch 1/2] mwifiex: add a kfree() to an error path

We're not likely to hit this small memory leak, but lets fix it anyway to keep the static checkers happy.

Thanks,
Bing

Quoted 13 lines
drivers/net/wireless/mwifiex/sta_ioctl.c +1 -0
index eb569fa..215c65a 100644
@@ -203,6 +203,7 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
 		beacon_ie = kmemdup(bss->information_elements,
 					bss->len_beacon_ies, GFP_KERNEL);
 		if (!beacon_ie) {
+			kfree(bss_desc);
 			dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n");
 			return -ENOMEM;
 		}