diff options
author | Julia Lawall <julia@diku.dk> | 2011-08-12 13:31:30 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-08-12 13:33:31 -0400 |
commit | f8afdf481f0fef5e170c6c928cec42879d505654 (patch) | |
tree | d5731d783f50c21f5fd0bbff19dc80995589b698 /drivers/net/wireless/wl12xx/acx.c | |
parent | 674db1344443204b6ce3293f2df8fd1b7665deea (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/wireless/wl12xx/acx.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/acx.c | 6 |
1 files changed, 1 insertions, 5 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 | ||
83 | out: | 81 | out: |
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 | ||
632 | out: | 628 | out: |
633 | kfree(detection); | 629 | kfree(detection); |