All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Singh, Guneshwor" <guneshwor.o.singh@intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: ALSA ML <alsa-devel@alsa-project.org>,
	Vinod Koul <vinod.koul@intel.com>,
	Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	Patches Audio <patches.audio@intel.com>,
	Mark Brown <broonie@kernel.org>,
	"Subhransu S. Prusty" <subhransu.s.prusty@intel.com>
Subject: Re: [PATCH] ALSA: hda - Fix memory leak on snd_hdac_device_init error
Date: Thu, 9 Nov 2017 16:59:08 +0530	[thread overview]
Message-ID: <20171109112908.GA2856@g2> (raw)
In-Reply-To: <s5hvaijvrf7.wl-tiwai@suse.de>

On Thu, Nov 09, 2017 at 08:31:56AM +0100, Takashi Iwai wrote:
> On Thu, 09 Nov 2017 05:44:19 +0100,
> Vinod Koul wrote:
> > 
> > On Thu, Nov 09, 2017 at 08:57:51AM +0530, Guneshwor Singh wrote:
> > > From: "Subhransu S. Prusty" <subhransu.s.prusty@intel.com>
> > > 
> > > Free codec vendor name on snd_hdac_device_init error.
> > > 
> > > Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
> > > Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
> > > ---
> > >  sound/hda/hdac_device.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > > 
> > > diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c
> > > index 19deb306facb..467b949544e2 100644
> > > --- a/sound/hda/hdac_device.c
> > > +++ b/sound/hda/hdac_device.c
> > > @@ -111,6 +111,8 @@ int snd_hdac_device_init(struct hdac_device *codec, struct hdac_bus *bus,
> > >  	return 0;
> > >  
> > >   error:
> > > +	kfree(codec->vendor_name);
> > 
> > Sorry I dont think this is right.
> > 
> > The vendor name is freed in the snd_hdac_device_exit()
> > 
> > We drop the reference here and release method would be called to
> > free up the resources.
> 
> Correct.  The patch would lead to a double-free.
> 
> 

Yes, you are right. Please ignore the patch.

> thanks,
> 
> Takashi
> 
> 
> > 
> > >  	put_device(&codec->dev);
> > >  	return err;
> > >  }
> > > -- 
> > > 2.15.0
> > > 
> > 
> > -- 
> > ~Vinod
> > 

      reply	other threads:[~2017-11-09 11:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-09  3:27 [PATCH] ALSA: hda - Fix memory leak on snd_hdac_device_init error Guneshwor Singh
2017-11-09  4:44 ` Vinod Koul
2017-11-09  7:31   ` Takashi Iwai
2017-11-09 11:29     ` Singh, Guneshwor [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=20171109112908.GA2856@g2 \
    --to=guneshwor.o.singh@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=patches.audio@intel.com \
    --cc=subhransu.s.prusty@intel.com \
    --cc=tiwai@suse.de \
    --cc=vinod.koul@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.