From: Santosh Kumar Singh <kumar.san1093@gmail.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hans.verkuil@cisco.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Wolfram Sang <wsa-dev@sang-engineering.com>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
Santosh Kumar Singh <kumar.san1093@gmail.com>
Subject: [PATCH] tm6000: Clean up file handle in open() error path.
Date: Mon, 19 Dec 2016 22:27:11 +0530 [thread overview]
Message-ID: <1482166631-4025-1-git-send-email-kumar.san1093@gmail.com> (raw)
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
next reply other threads:[~2016-12-19 17:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-19 16:57 Santosh Kumar Singh [this message]
2016-12-19 17:10 Santosh Kumar Singh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1482166631-4025-1-git-send-email-kumar.san1093@gmail.com \
--to=kumar.san1093@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hans.verkuil@cisco.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=wsa-dev@sang-engineering.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®