From: daniel.lezcano@linaro.org (Daniel Lezcano)
To: linux-arm-kernel@lists.infradead.org
Subject: [Bug] ARM: cpuidle: possible memleak
Date: Tue, 29 Aug 2017 11:04:43 +0200 [thread overview]
Message-ID: <7a5e668d-61dc-90f2-deae-36ef3398af07@linaro.org> (raw)
In-Reply-To: <299133306.50715.1503747980116@email.1und1.de>
On 26/08/2017 13:46, Stefan Wahren wrote:
[ ... ]
>> diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c
>> index 7080c38..827ab25 100644
>> --- a/drivers/cpuidle/cpuidle-arm.c
>> +++ b/drivers/cpuidle/cpuidle-arm.c
>> @@ -104,12 +104,14 @@ static int __init arm_idle_init(void)
>> ret = dt_init_idle_driver(drv, arm_idle_state_match, 1);
>> if (ret <= 0) {
>> ret = ret ? : -ENODEV;
>> + kfree(drv);
>> goto out_fail;
>> }
>>
>> ret = cpuidle_register_driver(drv);
>> if (ret) {
>> pr_err("Failed to register cpuidle driver\n");
>> + kfree(drv);
>> goto out_fail;
>> }
I would prefer if you create another label on top of out_fail to free
'drv' and 'dev'. So you can remove the kfree in this loop (also take the
opportunity to remove the pr_err("Failed to allocate cpuidle device")
message.
> should i split this patch (fix for "my" memleak and cleanup fix)?
Yes, please.
Thanks.
-- Daniel
--
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
prev parent reply other threads:[~2017-08-29 9:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-12 13:19 [Bug] ARM: cpuidle: possible memleak Stefan Wahren
2017-08-13 3:50 ` Leo Yan
2017-08-13 10:10 ` Stefan Wahren
2017-08-26 11:46 ` Stefan Wahren
2017-08-29 9:04 ` Daniel Lezcano [this message]
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=7a5e668d-61dc-90f2-deae-36ef3398af07@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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