All of lore.kernel.org
 help / color / mirror / Atom feed
* Small memory leak in snd_pcm_ladspa_init()
@ 2010-07-21 15:48 John Lindgren
  2010-07-21 22:13 ` Jaroslav Kysela
  0 siblings, 1 reply; 3+ messages in thread
From: John Lindgren @ 2010-07-21 15:48 UTC (permalink / raw)
  To: alsa-devel

Hello,

Valgrind shows up a small memory leak in libasound when using a LADSPA
plugin.  Sorry, I don't have a patch this time.

==30783== 16 bytes in 2 blocks are definitely lost in loss record 1,976 of 6,954
==30783==    at 0x4C2380C: calloc (vg_replace_malloc.c:467)
==30783==    by 0x1B06BEFD: snd_pcm_ladspa_init (pcm_ladspa.c:744)
==30783==    by 0x1B04B325: snd_pcm_plugin_prepare (pcm_plugin.c:167)
==30783==    by 0x1B04B2EE: snd_pcm_plugin_prepare (pcm_plugin.c:158)

==30783== 16 bytes in 2 blocks are definitely lost in loss record 1,977 of 6,954
==30783==    at 0x4C2380C: calloc (vg_replace_malloc.c:467)
==30783==    by 0x1B06BF25: snd_pcm_ladspa_init (pcm_ladspa.c:746)
==30783==    by 0x1B04B325: snd_pcm_plugin_prepare (pcm_plugin.c:167)
==30783==    by 0x1B04B2EE: snd_pcm_plugin_prepare (pcm_plugin.c:158)

...

==30783== 16 bytes in 2 blocks are definitely lost in loss record 1,980 of 6,954
==30783==    at 0x4C2380C: calloc (vg_replace_malloc.c:467)
==30783==    by 0x1B06BEFD: snd_pcm_ladspa_init (pcm_ladspa.c:744)
==30783==    by 0x1B04B325: snd_pcm_plugin_prepare (pcm_plugin.c:167)
==30783==    by 0x1B04B2EE: snd_pcm_plugin_prepare (pcm_plugin.c:158)
==30783==    by 0x1B03B2DC: snd_pcm_recover (pcm.c:7246)

==30783== 16 bytes in 2 blocks are definitely lost in loss record 1,981 of 6,954
==30783==    at 0x4C2380C: calloc (vg_replace_malloc.c:467)
==30783==    by 0x1B06BF25: snd_pcm_ladspa_init (pcm_ladspa.c:746)
==30783==    by 0x1B04B325: snd_pcm_plugin_prepare (pcm_plugin.c:167)
==30783==    by 0x1B04B2EE: snd_pcm_plugin_prepare (pcm_plugin.c:158)
==30783==    by 0x1B03B2DC: snd_pcm_recover (pcm.c:7246)

... and so on.

-- John

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Small memory leak in snd_pcm_ladspa_init()
  2010-07-21 15:48 Small memory leak in snd_pcm_ladspa_init() John Lindgren
@ 2010-07-21 22:13 ` Jaroslav Kysela
  2010-07-22  2:32   ` John Lindgren
  0 siblings, 1 reply; 3+ messages in thread
From: Jaroslav Kysela @ 2010-07-21 22:13 UTC (permalink / raw)
  To: John Lindgren; +Cc: alsa-devel

n Wed, 21 Jul 2010, John Lindgren wrote:

> Hello,
>
> Valgrind shows up a small memory leak in libasound when using a LADSPA
> plugin.  Sorry, I don't have a patch this time.

Does this patch help?

diff --git a/src/pcm/pcm_ladspa.c b/src/pcm/pcm_ladspa.c
index 5161820..c413c10 100644
--- a/src/pcm/pcm_ladspa.c
+++ b/src/pcm/pcm_ladspa.c
@@ -341,6 +341,8 @@ static void snd_pcm_ladspa_free_instances(snd_pcm_t *pcm, snd_pcm_ladspa_t *lads
  						free(instance->output.m_data[idx]);
  					free(instance->output.m_data);
                                  }
+                                free(instance->input.data);
+                                free(instance->output.data);
  				list_del(&(instance->list));
  				snd_pcm_ladspa_free_eps(&instance->input);
  				snd_pcm_ladspa_free_eps(&instance->output);

-----
Jaroslav Kysela <perex@perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: Small memory leak in snd_pcm_ladspa_init()
  2010-07-21 22:13 ` Jaroslav Kysela
@ 2010-07-22  2:32   ` John Lindgren
  0 siblings, 0 replies; 3+ messages in thread
From: John Lindgren @ 2010-07-22  2:32 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: alsa-devel

Yes, that fixes it.  Thank you.

-- John

On 07/21/2010 06:13 PM, Jaroslav Kysela wrote:
> Does this patch help?
>
> diff --git a/src/pcm/pcm_ladspa.c b/src/pcm/pcm_ladspa.c
> index 5161820..c413c10 100644
> --- a/src/pcm/pcm_ladspa.c
> +++ b/src/pcm/pcm_ladspa.c
> @@ -341,6 +341,8 @@ static void snd_pcm_ladspa_free_instances(snd_pcm_t *pcm, snd_pcm_ladspa_t *lads
>   						free(instance->output.m_data[idx]);
>   					free(instance->output.m_data);
>                                   }
> +                                free(instance->input.data);
> +                                free(instance->output.data);
>   				list_del(&(instance->list));
>   				snd_pcm_ladspa_free_eps(&instance->input);
>   				snd_pcm_ladspa_free_eps(&instance->output);
>
> -----
> Jaroslav Kysela <perex@perex.cz>
> Linux Kernel Sound Maintainer
> ALSA Project, Red Hat, Inc.
>   

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-22  2:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-21 15:48 Small memory leak in snd_pcm_ladspa_init() John Lindgren
2010-07-21 22:13 ` Jaroslav Kysela
2010-07-22  2:32   ` John Lindgren

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.