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: Daniel Almeida <daniel.almeida@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Daniel Almeida 2021-07-02 03:01:28 +01:00 коммит произвёл Mauro Carvalho Chehab
Родитель fd2eda71a4
Коммит fe47b6d758
1 изменённых файлов: 1 добавлений и 0 удалений

Просмотреть файл

@ -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;
}