Skip to contentSkip to conversation

drivers/media/video/zr364xx.c: add missing cleanup code

PATCH New Julia Lawall 1 participant 1 message Aug 12, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/media/video/zr364xx.c: add missing cleanup code

From: Julia Lawall <[email protected]>

It seems just as necessary to free cam->vdev and cam in this error case as in the next one.

---
There is yet another block of error handling code below the call to zr364xx_board_init, but perhaps no cleanup code is needed in that case, because that code is currently initializing a lock in cam?

 drivers/media/video/zr364xx.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/media/video/zr364xx.c +3 -0
index c492846..e78cf94 100644
@@ -1638,6 +1638,9 @@ static int zr364xx_probe(struct usb_interface *intf,
 
 	if (!cam->read_endpoint) {
 		dev_err(&intf->dev, "Could not find bulk-in endpoint\n");
+		video_device_release(cam->vdev);
+		kfree(cam);
+		cam = NULL;
 		return -ENOMEM;
 	}