All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Reimar Döffinger" <Reimar.Doeffinger@stud.uni-karlsruhe.de>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: Memleak with mixer? Or incorrect code?
Date: Thu, 13 Jan 2005 18:07:38 +0100	[thread overview]
Message-ID: <s5hpt09i7fp.wl@alsa2.suse.de> (raw)
In-Reply-To: <20050112112320.GA5411@rz.uni-karlsruhe.de>

[-- Attachment #1: Type: text/plain, Size: 555 bytes --]

At Wed, 12 Jan 2005 12:23:20 +0100,
Reimar Döffinger wrote:
> 
> Hi,
> the attached code consumes more and more memory when I run it (with alsa
> 1.0.3 as included in SuSE 9.1).
> Why is that so? Did I forget to free something?
> Both commenting out the snd_mixer_selem_register or the snd_mixer_load
> call will fix it, but that's not an option in real code (this is
> actually a stripped-down version of the code in MPlayer's ao_alsa.c)...
> Any hints on that??

Yep, it hits a memory leak bug.
The patch below should fix it.


Takashi

[-- Attachment #2: Type: text/plain, Size: 465 bytes --]

Index: alsa-lib/src/mixer/bag.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-lib/src/mixer/bag.c,v
retrieving revision 1.4
diff -u -r1.4 bag.c
--- alsa-lib/src/mixer/bag.c	2 Jan 2002 12:01:22 -0000	1.4
+++ alsa-lib/src/mixer/bag.c	13 Jan 2005 16:53:44 -0000
@@ -59,6 +59,7 @@
 		bag1_t *b = list_entry(pos, bag1_t, list);
 		if (b->ptr == ptr) {
 			list_del(&b->list);
+			free(b);
 			return 0;
 		}
 	}

  reply	other threads:[~2005-01-13 17:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-12 11:23 Memleak with mixer? Or incorrect code? Reimar Döffinger
2005-01-13 17:07 ` Takashi Iwai [this message]
2005-01-18 20:15   ` Reimar Döffinger

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=s5hpt09i7fp.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=Reimar.Doeffinger@stud.uni-karlsruhe.de \
    --cc=alsa-devel@lists.sourceforge.net \
    /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.