summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWenwen Wang <wenwen@cs.uga.edu>2019-08-18 02:58:53 -0300
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-08-26 10:41:17 -0300
commit51d47e578a74c687bd71e462ef7db039ce38a964 (patch)
tree26282bb741d34f07cdacdfbbf8854b674fda1783
parent42e64117d3b4a759013f77bbcf25ab6700e55de7 (diff)
downloadlinux-0-day-51d47e578a74c687bd71e462ef7db039ce38a964.tar.gz
linux-0-day-51d47e578a74c687bd71e462ef7db039ce38a964.tar.xz
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>
-rw-r--r--drivers/media/platform/rcar_fdp1.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/media/platform/rcar_fdp1.c b/drivers/media/platform/rcar_fdp1.c
index c23ec127c2776..cb93a13e1777a 100644
--- a/drivers/media/platform/rcar_fdp1.c
+++ b/drivers/media/platform/rcar_fdp1.c
@@ -2122,6 +2122,7 @@ static int fdp1_open(struct file *file)
if (ctx->hdl.error) {
ret = ctx->hdl.error;
v4l2_ctrl_handler_free(&ctx->hdl);
+ kfree(ctx);
goto done;
}