hi846_init_controls doesn't clean the allocated ctrl_hdlr in case there is a failure, which causes memleak. Add v4l2_ctrl_handler_free to free the resource properly. Signed-off-by: Wei Chen <harperchen1110@xxxxxxxxx> --- drivers/media/i2c/hi846.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/i2c/hi846.c b/drivers/media/i2c/hi846.c index 7c61873b7198..c45a6511d2c1 100644 --- a/drivers/media/i2c/hi846.c +++ b/drivers/media/i2c/hi846.c @@ -1472,6 +1472,7 @@ static int hi846_init_controls(struct hi846 *hi846) if (ctrl_hdlr->error) { dev_err(&client->dev, "v4l ctrl handler error: %d\n", ctrl_hdlr->error); + v4l2_ctrl_handler_free(ctrl_hdlr); return ctrl_hdlr->error; } -- 2.25.1