From: Jon Hunter <jonathanh@nvidia.com>
To: Gen Zhang <blackgod016574@gmail.com>, <broonie@kernel.org>,
<tiwai@suse.com>
Cc: <alsa-devel@alsa-project.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] pcm030-audio-fabric: Fix a memory leaking bug in pcm030_fabric_probe()
Date: Fri, 24 May 2019 10:30:09 +0100 [thread overview]
Message-ID: <0fb5b294-99ba-bb73-a972-e1886dc6b792@nvidia.com> (raw)
In-Reply-To: <20190524021221.GA4753@zhanggen-UX430UQ>
On 24/05/2019 03:12, Gen Zhang wrote:
> In pcm030_fabric_probe(), 'pdata->codec_device' is allocated by
> platform_device_alloc(). When this allocation fails, ENOMEM is returned.
> However, 'pdata' is allocated by devm_kzalloc() before this site. We
> should free 'pdata' before function ends to prevent memory leaking.
>
> Similarly, we should free 'pdata' when 'pdata->codec_device' is NULL.
> And we should free 'pdata->codec_device' and 'pdata' when 'ret' is error
> to prevent memory leaking.
>
> Signed-off-by: Gen Zhang <blackgod016574@gmail.com>
I have seen several of these patches now, and this is not correct. I
think you need to understand how devm_kzalloc() works.
Jon
--
nvpublic
prev parent reply other threads:[~2019-05-24 9:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-24 2:12 Gen Zhang
2019-05-24 9:30 ` Jon Hunter [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=0fb5b294-99ba-bb73-a972-e1886dc6b792@nvidia.com \
--to=jonathanh@nvidia.com \
--cc=alsa-devel@alsa-project.org \
--cc=blackgod016574@gmail.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tiwai@suse.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
Powered by JetHome