Commit 7c13a4d6 authored by Santosh Kumar Singh's avatar Santosh Kumar Singh Committed by Mauro Carvalho Chehab

[media] 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: default avatarSantosh Kumar Singh <kumar.san1093@gmail.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent c4d27f4b
...@@ -907,6 +907,7 @@ static int vim2m_open(struct file *file) ...@@ -907,6 +907,7 @@ static int vim2m_open(struct file *file)
if (hdl->error) { if (hdl->error) {
rc = hdl->error; rc = hdl->error;
v4l2_ctrl_handler_free(hdl); v4l2_ctrl_handler_free(hdl);
kfree(ctx);
goto open_unlock; goto open_unlock;
} }
ctx->fh.ctrl_handler = hdl; ctx->fh.ctrl_handler = hdl;
...@@ -928,6 +929,7 @@ static int vim2m_open(struct file *file) ...@@ -928,6 +929,7 @@ static int vim2m_open(struct file *file)
rc = PTR_ERR(ctx->fh.m2m_ctx); rc = PTR_ERR(ctx->fh.m2m_ctx);
v4l2_ctrl_handler_free(hdl); v4l2_ctrl_handler_free(hdl);
v4l2_fh_exit(&ctx->fh);
kfree(ctx); kfree(ctx);
goto open_unlock; goto open_unlock;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment