aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2011-08-12 13:31:30 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-08-12 13:33:31 -0400
commitf8afdf481f0fef5e170c6c928cec42879d505654 (patch)
treed5731d783f50c21f5fd0bbff19dc80995589b698 /drivers/net
parent674db1344443204b6ce3293f2df8fd1b7665deea (diff)
drivers/net/wireless/wl12xx: add missing kfree
In each case, the freed data should be freed in the error handling code as well. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @exists@ local idexpression x; statement S,S1; expression E; identifier fl; expression *ptr != NULL; @@ x = \(kmalloc\|kzalloc\|kcalloc\)(...); ... if (x == NULL) S <... when != x when != if (...) { <+...kfree(x)...+> } when any when != true x == NULL x->fl ...> ( if (x == NULL) S1 | if (...) { ... when != x when forall ( return \(0\|<+...x...+>\|ptr\); | * return ...; ) } ) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Acked-by: Luciano Coelho <coelho@ti.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/wl12xx/acx.c6
-rw-r--r--drivers/net/wireless/wl12xx/testmode.c5
2 files changed, 5 insertions, 6 deletions
diff --git a/drivers/net/wireless/wl12xx/acx.c b/drivers/net/wireless/wl12xx/acx.c
index 7e33f1f4f3d4..34f6ab53e519 100644
--- a/drivers/net/wireless/wl12xx/acx.c
+++ b/drivers/net/wireless/wl12xx/acx.c
@@ -77,8 +77,6 @@ int wl1271_acx_sleep_auth(struct wl1271 *wl, u8 sleep_auth)
77 auth->sleep_auth = sleep_auth; 77 auth->sleep_auth = sleep_auth;
78 78
79 ret = wl1271_cmd_configure(wl, ACX_SLEEP_AUTH, auth, sizeof(*auth)); 79 ret = wl1271_cmd_configure(wl, ACX_SLEEP_AUTH, auth, sizeof(*auth));
80 if (ret < 0)
81 return ret;
82 80
83out: 81out:
84 kfree(auth); 82 kfree(auth);
@@ -624,10 +622,8 @@ int wl1271_acx_cca_threshold(struct wl1271 *wl)
624 622
625 ret = wl1271_cmd_configure(wl, ACX_CCA_THRESHOLD, 623 ret = wl1271_cmd_configure(wl, ACX_CCA_THRESHOLD,
626 detection, sizeof(*detection)); 624 detection, sizeof(*detection));
627 if (ret < 0) { 625 if (ret < 0)
628 wl1271_warning("failed to set cca threshold: %d", ret); 626 wl1271_warning("failed to set cca threshold: %d", ret);
629 return ret;
630 }
631 627
632out: 628out:
633 kfree(detection); 629 kfree(detection);
diff --git a/drivers/net/wireless/wl12xx/testmode.c b/drivers/net/wireless/wl12xx/testmode.c
index 5d5e1ef87206..88add68bd9ac 100644
--- a/drivers/net/wireless/wl12xx/testmode.c
+++ b/drivers/net/wireless/wl12xx/testmode.c
@@ -139,12 +139,15 @@ static int wl1271_tm_cmd_interrogate(struct wl1271 *wl, struct nlattr *tb[])
139 139
140 if (ret < 0) { 140 if (ret < 0) {
141 wl1271_warning("testmode cmd interrogate failed: %d", ret); 141 wl1271_warning("testmode cmd interrogate failed: %d", ret);
142 kfree(cmd);
142 return ret; 143 return ret;
143 } 144 }
144 145
145 skb = cfg80211_testmode_alloc_reply_skb(wl->hw->wiphy, sizeof(*cmd)); 146 skb = cfg80211_testmode_alloc_reply_skb(wl->hw->wiphy, sizeof(*cmd));
146 if (!skb) 147 if (!skb) {
148 kfree(cmd);
147 return -ENOMEM; 149 return -ENOMEM;
150 }
148 151
149 NLA_PUT(skb, WL1271_TM_ATTR_DATA, sizeof(*cmd), cmd); 152 NLA_PUT(skb, WL1271_TM_ATTR_DATA, sizeof(*cmd), cmd);
150 153