From: Wei Chen <harperchen1110@gmail.com>
To: martink@posteo.de
Cc: mchehab@kernel.org, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org, Wei Chen <harperchen1110@gmail.com>
Subject: [PATCH] media: hi846: Fix memleak in hi846_init_controls()
Date: Fri, 24 Mar 2023 17:24:27 +0000 [thread overview]
Message-ID: <20230324172427.3416342-1-harperchen1110@gmail.com> (raw)
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@gmail.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
next reply other threads:[~2023-03-24 17:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-24 17:24 Wei Chen [this message]
2023-03-26 8:50 ` Martin Kepplinger
2023-03-26 9:11 ` Wei Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230324172427.3416342-1-harperchen1110@gmail.com \
--to=harperchen1110@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=martink@posteo.de \
--cc=mchehab@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®