]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
insert the twin, not the entry we're deleting
authorAlan T. DeKok <aland@freeradius.org>
Sat, 26 Mar 2022 01:22:05 +0000 (21:22 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sat, 26 Mar 2022 01:52:07 +0000 (21:52 -0400)
src/lib/server/cf_util.c

index 7bc249d8379397b836def5672bdaf3231340cfa1..27b42ff0bdf565589d54a53b4011cbfe143c62d9 100644 (file)
@@ -415,18 +415,19 @@ CONF_ITEM *_cf_item_remove(CONF_ITEM *parent, CONF_ITEM *child)
        }
 
        /*
-        *      Look for twins
+        *      Look for twins.  They weren't in the tree initially,
+        *      because "child" was there.
         */
        for (found = fr_dlist_head(&parent->children);
             found && (in_ident1 || in_ident2);
             found = fr_dlist_next(&parent->children, found)) {
                if (in_ident1 && (_cf_ident1_cmp(found, child) == 0)) {
-                       fr_rb_insert(parent->ident1, child);
+                       fr_rb_insert(parent->ident1, found);
                        in_ident1 = false;
                }
 
                if (in_ident2 && (_cf_ident2_cmp(found, child) == 0)) {
-                       fr_rb_insert(parent->ident2, child);
+                       fr_rb_insert(parent->ident2, found);
                        in_ident2 = false;
                }
        }