linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Santosh Kumar Singh <kumar.san1093@gmail.com>
Cc: "Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Hans Verkuil" <hverkuil@xs4all.nl>,
	"PJunghak Sung" <jh1009.sung@samsung.com>,
	"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vim2m: Clean up file handle in open() error path.
Date: Mon, 12 Dec 2016 11:38:08 +0200	[thread overview]
Message-ID: <4539600.dorPRmcVo7@avalon> (raw)
In-Reply-To: <1481131419-2921-1-git-send-email-kumar.san1093@gmail.com>

Hi Santosh,

Thank you for the patch.

On Wednesday 07 Dec 2016 22:53:39 Santosh Kumar Singh wrote:
> 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/platform/vim2m.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c
> index a98f679..9fd24b8 100644
> --- a/drivers/media/platform/vim2m.c
> +++ b/drivers/media/platform/vim2m.c
> @@ -907,6 +907,7 @@ static int vim2m_open(struct file *file)
>  	if (hdl->error) {
>  		rc = hdl->error;
>  		v4l2_ctrl_handler_free(hdl);
> +		kfree(ctx);
>  		goto open_unlock;
>  	}
>  	ctx->fh.ctrl_handler = hdl;
> @@ -929,6 +930,7 @@ static int vim2m_open(struct file *file)
> 
>  		v4l2_ctrl_handler_free(hdl);
>  		kfree(ctx);
> +		v4l2_fh_exit(&ctx->fh);

Don't you notice something wrong in those last two lines ?

>  		goto open_unlock;
>  	}

-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2016-12-12  9:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-07 17:23 [PATCH] vim2m: Clean up file handle in open() error path Santosh Kumar Singh
2016-12-12  9:38 ` Laurent Pinchart [this message]
     [not found] <1481595874-2528-1-git-send-email-kumar.san1093@gmail.com>
     [not found] ` <CAJte=rNoyROJ=JQzUHRAMrREV9cHbWdpEXYthPv8hrGDhD943Q@mail.gmail.com>
2016-12-16 12:34   ` Laurent Pinchart

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=4539600.dorPRmcVo7@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jh1009.sung@samsung.com \
    --cc=kumar.san1093@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    /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;
as well as URLs for NNTP newsgroup(s).