From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: memory leak in mix/pcm_upmix.c mix/pcm_downmix.c!!! Date: Wed, 30 Aug 2017 09:02:50 +0200 Message-ID: References: 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 mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 74193266A74 for ; Wed, 30 Aug 2017 09:02:51 +0200 (CEST) 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: boozer asm Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org On Wed, 30 Aug 2017 07:51:59 +0200, boozer asm wrote: > > eg. > in function:SND_PCM_PLUGIN_DEFINE_FUNC(upmix) > 487 mix = calloc(1, sizeof(*mix)); > 488 if (mix == NULL) > 489 return -ENOMEM; > > mix is allocated here. but at close function, it is not freed, and no > __destructor function available to free it. > > and in alsa-lib/src/pcm/pcm_extplug.c > static int snd_pcm_extplug_close(snd_pcm_t *pcm) > { > extplug_priv_t *ext = pcm->private_data; > > snd_pcm_close(ext->plug.gen.slave); > clear_ext_params(ext); > if (ext->data->callback->close) > { > ext->data->callback->close(ext->data); > } > free(ext); > return 0; > } > this function does NOT free ext->data. > and > 366 static int upmix_close(snd_pcm_extplug_t *ext) > 367 { > 368 snd_pcm_upmix_t *mix = (snd_pcm_upmix_t *)ext; > 369 free(mix->delayline[0]); > 370 free(mix->delayline[1]); > 371 return 0; > 372 } > > and this function does NOT free mix itself. > > so I think there is memory leak. It's freed in snd_pcm_extplug_close(). mix is identical with ext in the case of upmix. Takashi