From: Igor Putovny Date: Tue, 4 Mar 2025 14:06:10 +0000 (+0100) Subject: Fix trie_remove_prefix() to work with pruned trie X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f4f6e2e9d8bc8a2636dfb8ddce19165de4ddcd1;p=thirdparty%2Fbird.git Fix trie_remove_prefix() to work with pruned trie --- diff --git a/proto/aggregator/trie.c b/proto/aggregator/trie.c index fcaa9d39a..07c69049c 100644 --- a/proto/aggregator/trie.c +++ b/proto/aggregator/trie.c @@ -472,8 +472,11 @@ aggregator_trie_remove_prefix(struct aggregator_proto *p, ip_addr prefix, u32 px for (u32 i = 0; i < pxlen; i++) { u32 bit = ipa_getbit(prefix, i + ipa_shift[p->addr_type]); - node = node->child[bit]; - ASSERT_DIE(node != NULL); + + if (node->child[bit]) + node = node->child[bit]; + else + return node; } ASSERT_DIE(node->px_origin == ORIGINAL);