From 5d56a11a8ec399fe07a19dc17ef73f73a488046e Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Wed, 15 Jul 2009 11:20:29 +0200 Subject: [PATCH] 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 --- src/conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf.c b/src/conf.c index 97bf5e12..ccaeb3c1 100644 --- a/src/conf.c +++ b/src/conf.c @@ -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); -- 2.47.1