From: Michael Turquette <mturquette@baylibre.com>
To: Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
"Stephen Boyd" <sboyd@codeaurora.org>
Cc: linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
"Sudip Mukherjee" <sudipm.mukherjee@gmail.com>
Subject: Re: [PATCH] clk: gpio: fix memory leak
Date: Thu, 31 Dec 2015 21:32:28 -0800 [thread overview]
Message-ID: <20160101053228.21738.40065@quark.deferred.io> (raw)
In-Reply-To: <1450852439-366-1-git-send-email-sudipm.mukherjee@gmail.com>
Quoting Sudip Mukherjee (2015-12-22 22:33:59)
> If we fail to allocate parent_name then we are returning but we missed
> freeing data which has already been allocated.
>
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Applied.
Thanks,
Mike
> ---
> drivers/clk/clk-gpio.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/clk-gpio.c b/drivers/clk/clk-gpio.c
> index 335322d..c1baa89 100644
> --- a/drivers/clk/clk-gpio.c
> +++ b/drivers/clk/clk-gpio.c
> @@ -294,8 +294,10 @@ static void __init of_gpio_clk_setup(struct device_node *node,
> num_parents = of_clk_get_parent_count(node);
>
> parent_names = kcalloc(num_parents, sizeof(char *), GFP_KERNEL);
> - if (!parent_names)
> + if (!parent_names) {
> + kfree(data);
> return;
> + }
>
> for (i = 0; i < num_parents; i++)
> parent_names[i] = of_clk_get_parent_name(node, i);
> --
> 1.9.1
>
prev parent reply other threads:[~2016-01-01 5:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-23 6:33 Sudip Mukherjee
2016-01-01 5:32 ` Michael Turquette [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=20160101053228.21738.40065@quark.deferred.io \
--to=mturquette@baylibre.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sboyd@codeaurora.org \
--cc=sudipm.mukherjee@gmail.com \
/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®