From: Julia Lawall Date: Mon, 8 Aug 2011 11:17:58 +0000 (+0200) Subject: drivers/staging/bcm/nvm.c: add missing kfree X-Git-Tag: v3.2-rc1~169^2^2~864^2~161 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5969d55743c49dfca24e165a534cf5f2638e86b;p=pandora-kernel.git drivers/staging/bcm/nvm.c: add missing kfree Buff is only used as a temporary buffer within the function, so it should be freed before leaving the function in an error case. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @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 ...; ) } ) // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- Reading git-diff-tree failed