From: Wenwen Wang Date: Sun, 18 Aug 2019 05:58:53 +0000 (-0300) Subject: media: fdp1: Fix a memory leak bug X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=51d47e578a74c687bd71e462ef7db039ce38a964;p=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 Reviewed-by: Kieran Bingham Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- 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; }