linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tm6000: Clean up file handle in open() error path.
@ 2016-12-19 17:10 Santosh Kumar Singh
  0 siblings, 0 replies; 2+ messages in thread
From: Santosh Kumar Singh @ 2016-12-19 17:10 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Hans Verkuil, Greg Kroah-Hartman, Wolfram Sang
  Cc: linux-media, linux-kernel, Santosh Kumar Singh

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] tm6000: Clean up file handle in open() error path.
@ 2016-12-19 16:57 Santosh Kumar Singh
  0 siblings, 0 replies; 2+ messages in thread
From: Santosh Kumar Singh @ 2016-12-19 16:57 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Hans Verkuil, Greg Kroah-Hartman, Wolfram Sang
  Cc: linux-media, linux-kernel, Santosh Kumar Singh

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-19 17:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-19 17:10 [PATCH] tm6000: Clean up file handle in open() error path Santosh Kumar Singh
  -- strict thread matches above, loose matches on Subject: below --
2016-12-19 16:57 Santosh Kumar Singh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).