Skip to contentSkip to conversation

tm6000: Clean up file handle in open() error path.

PATCH New Santosh Kumar Singh 1 participant 1 message Dec 19, 2016 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tm6000: Clean up file handle in open() error path.

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

---
 drivers/media/usb/tm6000/tm6000-video.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/usb/tm6000/tm6000-video.c +4 -1
index dee7e7d..b39247a 100644
@@ -1377,8 +1377,11 @@ static int __tm6000_open(struct file *file)
 
 	/* initialize hardware on analog mode */
 	rc = tm6000_init_analog_mode(dev);
-	if (rc < 0)
+	if (rc < 0) {
+		v4l2_fh_exit(&fh->fh);
+		kfree(fh);
 		return rc;
+	}
 
 	dev->mode = TM6000_MODE_ANALOG;
 
Signature · 1 line
1.9.1