mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -04:00
conf.c: snd_config_add: prevent adopting a non-orphan
When adding a configuration node to another, check that the child node does not already have a parent. Otherwise, the old parent's children list would become corrupted. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
This commit is contained in:
parent
76c60af00a
commit
5d56a11a8e
1 changed files with 1 additions and 1 deletions
|
|
@ -1649,7 +1649,7 @@ int snd_config_add(snd_config_t *father, snd_config_t *leaf)
|
|||
{
|
||||
snd_config_iterator_t i, next;
|
||||
assert(father && leaf);
|
||||
if (!leaf->id)
|
||||
if (!leaf->id || leaf->father)
|
||||
return -EINVAL;
|
||||
snd_config_for_each(i, next, father) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue