mirror of https://gitee.com/openkylin/linux.git
059c438355
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> |
||
---|---|---|
.. | ||
Kconfig | ||
Makefile | ||
acx.c | ||
acx.h | ||
boot.c | ||
boot.h | ||
cmd.c | ||
cmd.h | ||
debugfs.c | ||
debugfs.h | ||
event.c | ||
event.h | ||
init.c | ||
init.h | ||
io.c | ||
io.h | ||
main.c | ||
ps.c | ||
ps.h | ||
reg.h | ||
rx.c | ||
rx.h | ||
sdio.c | ||
spi.c | ||
spi.h | ||
tx.c | ||
tx.h | ||
wl12xx_80211.h | ||
wl1251.h |