All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: boozer asm <asmboozer@gmail.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: memory leak in mix/pcm_upmix.c mix/pcm_downmix.c!!!
Date: Wed, 30 Aug 2017 10:32:15 +0200	[thread overview]
Message-ID: <s5hh8wp78xc.wl-tiwai@suse.de> (raw)
In-Reply-To: <CAOccgsWgrC65LapcMmBmzNjgNup=z5QXP+=SR3sieYkac26zrQ@mail.gmail.com>

On Wed, 30 Aug 2017 10:28:35 +0200,
boozer asm wrote:
> 
> not sure what's the best place to call free.
> 1.
> 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);
>     }
>     if (ext->data)
>          free(ext->data);
>     free(ext);
>     return 0;
> }
> 
> 2.
> 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]);
>           free(mix);
> 371     return 0;
> 372 }
> 
> 3. apply method in alsa-plugins/maemo/alsa-dsp.c:748:static void
> alsa_dsp_descructor(void) __attribute__ ((destructor));
> 
> with each methods, there are some plugins pcm_ files affected.

2 is the way to go.  1 may lead to double-free for the plugins that
have already the right code.  3 is too specific to implementation.


Takashi

      reply	other threads:[~2017-08-30  8:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-30  5:51 memory leak in mix/pcm_upmix.c mix/pcm_downmix.c!!! boozer asm
2017-08-30  5:55 ` boozer asm
2017-08-30  7:02 ` Takashi Iwai
2017-08-30  7:59   ` boozer asm
2017-08-30  8:17     ` Takashi Iwai
2017-08-30  8:28       ` boozer asm
2017-08-30  8:32         ` Takashi Iwai [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=s5hh8wp78xc.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=asmboozer@gmail.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.