From: Daniel Almeida <daniel.almeida@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxx> --- drivers/staging/media/sunxi/cedrus/cedrus.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c index c0d005dafc6c..e72810ace40f 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus.c @@ -207,6 +207,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; } -- 2.32.0