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


Groups > linux.kernel > #1540211

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

From Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Newsgroups linux.kernel
Subject Re: [PATCH] vim2m: Clean up file handle in open() error path.
Date 2016-12-12 10:40 +0100
Message-ID <sNvfr-2B3-3@gated-at.bofh.it> (permalink)
References <sLOcy-31p-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] vim2m: Clean up file handle in open() error path. Santosh Kumar Singh <kumar.san1093@gmail.com> - 2016-12-07 18:30 +0100
  Re: [PATCH] vim2m: Clean up file handle in open() error path. Laurent Pinchart <laurent.pinchart@ideasonboard.com> - 2016-12-12 10:40 +0100

csiph-web