From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] gpio/omap: fix possible memory leak in omap2_gpio_dev_init()
Date: Mon, 3 Sep 2012 12:11:06 +0100 [thread overview]
Message-ID: <20120903111106.GA24189@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <CAPgLHd9A0-Esqt8D87RunMWFFG7uTCERksia26DSO1xw8OUfmg@mail.gmail.com>
On Mon, Sep 03, 2012 at 06:13:33PM +0800, Wei Yongjun wrote:
> @@ -130,6 +132,7 @@ static int __init omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
>
> pdev = omap_device_build(name, id - 1, oh, pdata,
> sizeof(*pdata), NULL, 0, false);
> + kfree(pdata->regs);
> kfree(pdata);
This one looks wrong. pdata is copied by the internals of
omap_device_build(), which includes the 'regs' pointer, so it should not
be freed after a successful call to omap_device_build(). (It should,
however, be freed after an unsuccessful call.)
BTW, you want to copy Paul Walmsley with this patch (address in Cc).
prev parent reply other threads:[~2012-09-03 11:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-03 10:13 [PATCH] gpio/omap: fix possible memory leak in omap2_gpio_dev_init() Wei Yongjun
2012-09-03 11:11 ` Russell King - ARM Linux [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=20120903111106.GA24189@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--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;
as well as URLs for NNTP newsgroup(s).