From: Julia Lawall Date: Mon, 4 Jul 2011 14:11:41 +0000 (-0300) Subject: [media] drivers/media/video/cx231xx/cx231xx-cards.c: add missing kfree X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=ef60e8f5d58752879cc69d9746133f2416ac206a;p=linux-beck.git [media] drivers/media/video/cx231xx/cx231xx-cards.c: add missing kfree Clear the cx231xx_devused variable and free dev in the error handling code, as done in the error handling code nearby. The semantic match that finds this problem is as follows: // @r@ identifier x; @@ kfree(x) @@ identifier r.x; expression E1!=0,E2,E3,E4; statement S; @@ ( if (<+...x...+>) S | if (...) { ... when != kfree(x) when != if (...) { ... kfree(x); ... } when != x = E3 * return E1; } ... when != x = E2 if (...) { ... when != x = E4 kfree(x); ... return ...; } ) // Signed-off-by: Julia Lawall Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c index 4b22afee18cf..9a07d3df3e20 100644 --- a/drivers/media/video/cx231xx/cx231xx-cards.c +++ b/drivers/media/video/cx231xx/cx231xx-cards.c @@ -1125,6 +1125,9 @@ static int cx231xx_usb_probe(struct usb_interface *interface, if (assoc_desc->bFirstInterface != ifnum) { cx231xx_err(DRIVER_NAME ": Not found " "matching IAD interface\n"); + cx231xx_devused &= ~(1 << nr); + kfree(dev); + dev = NULL; return -ENODEV; }