From: Takashi Iwai Subject: Re: [PATCH 2/4] src/pcm/pcm_mmap.c: add missing free Date: Thu, 22 Sep 2011 12:49:13 +0200 Message-ID: References: <1316376277-1224-2-git-send-email-julia@diku.dk> 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 DDBC3103B18 for ; Thu, 22 Sep 2011 12:49:13 +0200 (CEST) In-Reply-To: <1316376277-1224-2-git-send-email-julia@diku.dk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Julia Lawall Cc: alsa-devel@alsa-project.org, sumsaha@gmail.com List-Id: alsa-devel@alsa-project.org At Sun, 18 Sep 2011 22:04:35 +0200, Julia Lawall wrote: > > From: Julia Lawall > > Something that is allocated using calloc is not freed on an error path. > > Signed-off-by: Julia Lawall > Signed-off-by: Suman Saha > > --- > Compile-tested only. > > src/pcm/pcm_mmap.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/src/pcm/pcm_mmap.c b/src/pcm/pcm_mmap.c > index 4621fe6..2a009c8 100644 > --- a/src/pcm/pcm_mmap.c > +++ b/src/pcm/pcm_mmap.c > @@ -320,8 +320,11 @@ int snd_pcm_mmap(snd_pcm_t *pcm) > snd_pcm_channel_info_t *i = &pcm->mmap_channels[c]; > i->channel = c; > err = snd_pcm_channel_info(pcm, i); > - if (err < 0) > + if (err < 0) { > + free(pcm->mmap_channels); > + pcm->mmap_channels = NULL; pcm->running_areas should be freed here, too. thanks, Takashi