mirror of https://gitee.com/openkylin/linux.git
media: fdp1: Fix a memory leak bug
In fdp1_open(), 'ctx' is allocated through kzalloc(). However, it is not deallocated if v4l2_ctrl_new_std() fails, leading to a memory leak bug. To fix this issue, free 'ctx' before going to the 'done' label. Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
parent
42e64117d3
commit
51d47e578a
|
@ -2122,6 +2122,7 @@ static int fdp1_open(struct file *file)
|
||||||
if (ctx->hdl.error) {
|
if (ctx->hdl.error) {
|
||||||
ret = ctx->hdl.error;
|
ret = ctx->hdl.error;
|
||||||
v4l2_ctrl_handler_free(&ctx->hdl);
|
v4l2_ctrl_handler_free(&ctx->hdl);
|
||||||
|
kfree(ctx);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue