[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230324172427.3416342-1-harperchen1110@gmail.com>
Date: Fri, 24 Mar 2023 17:24:27 +0000
From: Wei Chen <harperchen1110@...il.com>
To: martink@...teo.de
Cc: mchehab@...nel.org, linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org, Wei Chen <harperchen1110@...il.com>
Subject: [PATCH] media: hi846: Fix memleak in hi846_init_controls()
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@...il.com>
---
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
Powered by blists - more mailing lists