提交 7c13a4d6 编写于 作者: S Santosh Kumar Singh 提交者: 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: NSantosh Kumar Singh <kumar.san1093@gmail.com>
Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@s-opensource.com>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册