mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/5] drivers/media/video/cx231xx/cx231xx-cards.c: add missing kfree
@ 2011-07-04 14:11 Julia Lawall
  0 siblings, 0 replies; only message in thread
From: Julia Lawall @ 2011-07-04 14:11 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: kernel-janitors, Devin Heitmueller, Sri Devi, Jarod Wilson,
	Laurent Pinchart, linux-media, linux-kernel

From: Julia Lawall <julia@diku.dk>

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:
(http://coccinelle.lip6.fr/)

// <smpl>
@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 ...; }
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/media/video/cx231xx/cx231xx-cards.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c
index 2270381..c46dca9 100644
--- a/drivers/media/video/cx231xx/cx231xx-cards.c
+++ b/drivers/media/video/cx231xx/cx231xx-cards.c
@@ -1051,6 +1051,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;
 	}
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-07-04 14:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-04 14:11 [PATCH 1/5] drivers/media/video/cx231xx/cx231xx-cards.c: add missing kfree Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®