[alsa-devel] [PATCH] alsa-lib: snd_device_name_hint misbehaving

Takashi Iwai tiwai at suse.de
Tue Nov 3 09:03:59 CET 2009


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


More information about the Alsa-devel mailing list