Skip to content

Commit

Permalink
media: cedrus: fix double free
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Daniel Almeida authored and Mauro Carvalho Chehab committed Oct 18, 2021
1 parent fd2eda7 commit fe47b6d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/staging/media/sunxi/cedrus/cedrus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit fe47b6d

Please sign in to comment.