From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Singh, Guneshwor" Subject: Re: [PATCH] ALSA: hda - Fix memory leak on snd_hdac_device_init error Date: Thu, 9 Nov 2017 16:59:08 +0530 Message-ID: <20171109112908.GA2856@g2> References: <20171109032751.20573-1-guneshwor.o.singh@intel.com> <20171109044419.GD3187@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by alsa0.perex.cz (Postfix) with ESMTP id DC92B26773C for ; Thu, 9 Nov 2017 12:29:13 +0100 (CET) Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Takashi Iwai Cc: ALSA ML , Vinod Koul , Liam Girdwood , Patches Audio , Mark Brown , "Subhransu S. Prusty" List-Id: alsa-devel@alsa-project.org 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" > > > > > > Free codec vendor name on snd_hdac_device_init error. > > > > > > Signed-off-by: Subhransu S. Prusty > > > Signed-off-by: Guneshwor Singh > > > --- > > > 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 > >