Commit fe47b6d7 authored by Daniel Almeida's avatar Daniel Almeida Committed by Mauro Carvalho Chehab
Browse files

media: cedrus: fix double free



If v4l2_ctrl_new_custom fails in cedrus_init_ctrls the error path will
free ctx->ctrls, which is also freed in cedrus release. Fix this by
setting ctx->ctrls to NULL instead of inadvertently removing kfree
calls.

Signed-off-by: default avatarDaniel Almeida <daniel.almeida@collabora.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent fd2eda71
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -259,6 +259,7 @@ static int cedrus_init_ctrls(struct cedrus_dev *dev, struct cedrus_ctx *ctx)

			v4l2_ctrl_handler_free(hdl);
			kfree(ctx->ctrls);
			ctx->ctrls = NULL;
			return hdl->error;
		}