aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gschwantner <tharre3@gmail.com>2019-12-11 04:08:10 +0100
committerThomas Gschwantner <tharre3@gmail.com>2019-12-11 06:22:17 +0100
commit286d83010e22b1b11f8125f4b4dfe0a33959d93e (patch)
tree8fdbfc7248a8201ebd7bd5429b60c279401a7e28
parentProperly send and display wg_errno and errmsg (diff)
downloadwg-dynamic-286d83010e22b1b11f8125f4b4dfe0a33959d93e.tar.xz
wg-dynamic-286d83010e22b1b11f8125f4b4dfe0a33959d93e.zip
radix-trie: fix add() when no poolnodes exist
-rw-r--r--radix-trie.c5
1 files changed, 5 insertions, 0 deletions
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;