Browse Source

[media] tm6000: Clean up file handle in open() error path

Fix to avoid possible memory leak and exit file handle
in error paths.

Signed-off-by: Santosh Kumar Singh <kumar.san1093@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Santosh Kumar Singh 8 years ago
parent
commit
1e071039b1
1 changed files with 4 additions and 1 deletions
  1. 4 1
      drivers/media/usb/tm6000/tm6000-video.c

+ 4 - 1
drivers/media/usb/tm6000/tm6000-video.c

@@ -1371,8 +1371,11 @@ static int __tm6000_open(struct file *file)
 
 
 	/* initialize hardware on analog mode */
 	/* initialize hardware on analog mode */
 	rc = tm6000_init_analog_mode(dev);
 	rc = tm6000_init_analog_mode(dev);
-	if (rc < 0)
+	if (rc < 0) {
+		v4l2_fh_exit(&fh->fh);
+		kfree(fh);
 		return rc;
 		return rc;
+	}
 
 
 	dev->mode = TM6000_MODE_ANALOG;
 	dev->mode = TM6000_MODE_ANALOG;