vim2m: Clean up file handle in open() error path.
PATCH 1/1 vim2m: Clean up file handle in open() error path.
Fix to avoid possible memory leak and exit file handle in error paths.
Signed-off-by Santosh Kumar Singh <[email protected]>
--- drivers/media/platform/vim2m.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/vim2m.c +2 -0
@@ -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); goto open_unlock; }
Signature · 1 line
1.9.1
Hi Santosh,
Thank you for the patch.
Quoted 21 lines · 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 <[email protected]>--- drivers/media/platform/vim2m.c | 2 ++ 1 file changed, 2 insertions(+)drivers/media/platform/vim2m.c +1
-0@@ -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;
drivers/media/platform/vim2m.c static int vim2m_open(struct file *file) · line 933
Quoted 4 lines
drivers/media/platform/vim2m.c +1
-0@@ -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 ?
Quoted 2 lines
drivers/media/platform/vim2m.c +0
-0goto open_unlock; }
Signature · 3 lines
Regards, Laurent Pinchart