From 082707ac486978f5a9973dd9831d96b412e4f193 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Fri, 25 Mar 2022 21:22:05 -0400 Subject: [PATCH] insert the twin, not the entry we're deleting --- src/lib/server/cf_util.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib/server/cf_util.c b/src/lib/server/cf_util.c index 7bc249d837..27b42ff0bd 100644 --- a/src/lib/server/cf_util.c +++ b/src/lib/server/cf_util.c @@ -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; } } -- 2.47.2