LKML Archive on
help / color / mirror / Atom feed
From: Jon Hunter <>
To: Gen Zhang <>, <>,
Cc: <>, <>
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: <> (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 <>

I have seen several of these patches now, and this is not correct. I
think you need to understand how devm_kzalloc() works.



      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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \
    --subject='Re: [PATCH] pcm030-audio-fabric: Fix a memory leaking bug in pcm030_fabric_probe()' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).