Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1544677 > unrolled thread

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

Started bySantosh Kumar Singh <kumar.san1093@gmail.com>
First post2016-12-19 18:10 +0100
Last post2016-12-19 18:10 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] tm6000: Clean up file handle in open() error path. Santosh Kumar Singh <kumar.san1093@gmail.com> - 2016-12-19 18:10 +0100

#1544677 — [PATCH] tm6000: Clean up file handle in open() error path.

FromSantosh Kumar Singh <kumar.san1093@gmail.com>
Date2016-12-19 18:10 +0100
Subject[PATCH] tm6000: Clean up file handle in open() error path.
Message-ID<sQ9BL-2iR-11@gated-at.bofh.it>
Fix to avoid possible memory leak and exit file handle
in error paths.

Signed-off-by: Santosh Kumar Singh <kumar.san1093@gmail.com>
---
 drivers/media/usb/tm6000/tm6000-video.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm6000-video.c
index dee7e7d..b39247a 100644
--- a/drivers/media/usb/tm6000/tm6000-video.c
+++ b/drivers/media/usb/tm6000/tm6000-video.c
@@ -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;
 
-- 
1.9.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web