From 286d83010e22b1b11f8125f4b4dfe0a33959d93e Mon Sep 17 00:00:00 2001 From: Thomas Gschwantner Date: Wed, 11 Dec 2019 04:08:10 +0100 Subject: radix-trie: fix add() when no poolnodes exist --- radix-trie.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/radix-trie.c b/radix-trie.c index 3cb1e91..678f3be 100644 --- a/radix-trie.c +++ b/radix-trie.c @@ -223,6 +223,11 @@ static struct radix_node *add(struct radix_node **trie, uint8_t bits, } if (!*trie) { + if (type & RNODE_IS_LEAF) { + errno = ENOENT; + return NULL; + } + *trie = new_node(key, cidr, bits); (*trie)->flags = type; return *trie; -- cgit v1.2.3-59-g8ed1b