summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDaniel Almeida <daniel.almeida@collabora.com>2021-07-02 03:01:28 +0100
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-10-18 16:29:34 +0100
commitfe47b6d7582ad1a608d8341c3e02c3e06f5678e6 (patch)
treecd4c07d9056f4cc7409ade5c60791a8bd4a10297 /drivers
parentfd2eda71a47b095e81b9170c3f8b7ae82b04e785 (diff)
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/media/sunxi/cedrus/cedrus.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c
index 9dd30cb568e8..c76fc97d97a0 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus.c
@@ -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;
}