From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: Memleak with mixer? Or incorrect code? Date: Thu, 13 Jan 2005 18:07:38 +0100 Message-ID: References: <20050112112320.GA5411@rz.uni-karlsruhe.de> Mime-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: multipart/mixed; boundary="Multipart_Thu_Jan_13_18:07:38_2005-1" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20050112112320.GA5411@rz.uni-karlsruhe.de> Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Reimar =?ISO-8859-1?Q?D=F6ffinger?= Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org --Multipart_Thu_Jan_13_18:07:38_2005-1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable At Wed, 12 Jan 2005 12:23:20 +0100, Reimar D=F6ffinger wrote: >=20 > Hi, > the attached code consumes more and more memory when I run it (with als= a > 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 --Multipart_Thu_Jan_13_18:07:38_2005-1 Content-Type: text/plain; charset=US-ASCII 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; } } --Multipart_Thu_Jan_13_18:07:38_2005-1-- ------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt