powerpc/pmac/windfarm: Correct potential double free
authorJulia Lawall <julia@diku.dk>
Sun, 28 Mar 2010 23:39:22 +0000 (23:39 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 7 Apr 2010 08:00:40 +0000 (18:00 +1000)
commitab30f78c0afbb86584144925e25c7ca68ba9a91f
tree2ddd3972415c317c89b7c983463952721e04f5e4
parent637a99022fb119b90fb281715d13172f0394fc12
powerpc/pmac/windfarm: Correct potential double free

The conditionals were testing different values, but then all freeing the
same one, which could result in a double free.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,e;
identifier f;
iterator I;
statement S;
@@

*kfree(x);
... when != &x
    when != x = e
    when != I(x,...) S
*x
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
drivers/macintosh/windfarm_pm91.c