From: Takashi Iwai Subject: Re: [PATCH] coverity fix in alsa-libs Date: Thu, 18 Sep 2014 17:25:46 +0200 Message-ID: References: <07.8E.04938.6EEBA145@epcpsbgx1.samsung.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 140E8265559 for ; Thu, 18 Sep 2014 17:25:47 +0200 (CEST) In-Reply-To: <07.8E.04938.6EEBA145@epcpsbgx1.samsung.com> <31099563.98981411038949858.JavaMail.weblogic@epv6ml12> 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: renu.tyagi@samsung.com Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Thu, 18 Sep 2014 11:15:50 +0000 (GMT), Renu Tyagi wrote: > > > Hi, > Bug type : missing freeing resources before returning in case of errors > Files changed : sbase.c pcm_file.c > PFA patch > > ------------------------------------------------------------------- > From f201df1f5c5d129f21c663c81fdb495d9a3ca51e Mon Sep 17 00:00:00 2001 > From: renu tyagi > Date: Thu, 18 Sep 2014 16:17:55 +0530 > Subject: [PATCH 2/8] [sbase , pcm_file] : freeing resources before returning in case of errors Please just send the patch as is. We don't need any foreword. Also, if the changes cover over different areas, split the patch. thanks, Takashi > Signed-off-by: renu tyagi > --- > modules/mixer/simple/sbase.c | 1 + > src/pcm/pcm_file.c | 2 ++ > 2 files changed, 3 insertions(+), 0 deletions(-) > > diff --git a/modules/mixer/simple/sbase.c b/modules/mixer/simple/sbase.c > index 97feee8..bb2f59d 100644 > --- a/modules/mixer/simple/sbase.c > +++ b/modules/mixer/simple/sbase.c > @@ -377,6 +377,7 @@ static int simple_event_add1(snd_mixer_class_t *class, > if (ctype != SND_CTL_ELEM_TYPE_BOOLEAN) { > __invalid_type: > snd_mixer_selem_id_free(id); > + free(hsimple); > return -EINVAL; > } > break; > diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c > index a0b8bf4..f6d222f 100644 > --- a/src/pcm/pcm_file.c > +++ b/src/pcm/pcm_file.c > @@ -758,6 +758,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, > ifd = open(ifname, O_RDONLY); /* TODO: mind blocking mode */ > if (ifd < 0) { > SYSERR("open %s for reading failed", ifname); > + free(file->fname); > free(file); > return -errno; > } > @@ -772,6 +773,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, > err = snd_pcm_new(&pcm, SND_PCM_TYPE_FILE, name, slave->stream, slave->mode); > if (err < 0) { > free(file->fname); > + free(file->ifname); > free(file); > return err; > } > -- > 1.7.1 > > Thanks > Renu Tyagi >