drivers/net/wireless/wl1251: add missing kfree
authorJulia Lawall <julia@diku.dk>
Mon, 8 Aug 2011 11:18:03 +0000 (13:18 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 10 Aug 2011 18:07:10 +0000 (14:07 -0400)
commit059c4383550b158bc1b6d34d8ab085e81cb3d71b
tree903a3b657555ae78c576150f054a2e143ea539b6
parentbdc71bc59231f5542af13b5061b9ab124d093050
drivers/net/wireless/wl1251: add missing kfree

In each case, the kfree already at the end of the function is also needed
in the error case.

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>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/wl1251/acx.c
drivers/net/wireless/wl1251/cmd.c