From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH] alsa-lib: snd_device_name_hint misbehaving Date: Tue, 03 Nov 2009 09:03:59 +0100 Message-ID: References: <1257128586.16837.29.camel@dark-knight> <1257172994.2856.2.camel@dark-knight> <1257184700.1937.8.camel@dark-knight> 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 mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id DFD48103806 for ; Tue, 3 Nov 2009 09:03:59 +0100 (CET) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: John Lindgren Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Tue, 03 Nov 2009 08:09:34 +0100, I wrote: > > At Mon, 02 Nov 2009 12:58:20 -0500, > John Lindgren wrote: > > > > On Mon, 2009-11-02 at 15:55 +0100, Takashi Iwai wrote: > > > Thanks. I guess this depends on the config files. > > > Could you attach your ones? > > > > I can reproduce with only the stock /usr/share/alsa/alsa.conf from > > Debian installed if I try to use the "null" device after > > snd_device_name_hint. /usr/share/alsa/alsa.conf is attached. > > Thanks! I could reproduce the problem on my machine, too. > > Now I think I found the culprit. This is not in the core conf.c code, > but it's in namehint.c. Try the patch below. > > The point is that the variable "res" can be two different instances > in try_config(). One is the result of snd_config_search_definition(). > In this case, res is the copied (expanded) objects. > > This one is freed in the middle of try_config(), and then res is > assigned again to another one by snd_config_search_alias_hooks(). > This guy is no expanded object but a reference. > > However, the original code calls snd_config_free(res) no matter which > object is. So, freeing the latter one results in the breakage of the > config tree. > > The patch adds the check of the object type to be freed or not. Since no problem is found with valgrind, I applied the patch to git tree now. thanks, Takashi