Fix infinite parse of recursive definitions

Fixed the infinite parse (and eventually segfault) of recursive definitions.
Also fixed the parse of a string slave PCM of direct plugins.
This commit is contained in:
Takashi Iwai 2006-01-30 14:41:51 +00:00
parent bf174b7046
commit eccc92a34d
29 changed files with 127 additions and 36 deletions

View file

@ -440,6 +440,7 @@ struct _snd_config {
} u;
struct list_head list;
snd_config_t *father;
int hop;
};
struct filedesc {
@ -4011,6 +4012,24 @@ int snd_config_search_definition(snd_config_t *config,
return snd_config_expand(conf, config, args, NULL, result);
}
#ifndef DOC_HIDDEN
void snd_config_set_hop(snd_config_t *conf, int hop)
{
conf->hop = hop;
}
int snd_config_check_hop(snd_config_t *conf)
{
if (conf) {
if (conf->hop >= SND_CONF_MAX_HOPS) {
SYSERR("Too many definition levels (looped?)\n");
return -EINVAL;
}
return conf->hop;
}
return 0;
}
#endif
#if 0
/* Not strictly needed, but useful to check for memory leaks */