Commit 51d47e57 authored by Wenwen Wang's avatar Wenwen Wang Committed by Mauro Carvalho Chehab
Browse files

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: default avatarWenwen Wang <wenwen@cs.uga.edu>
Reviewed-by: default avatarKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 42e64117
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;
	}