summaryrefslogtreecommitdiffstats
path: root/zix/trie.c
diff options
context:
space:
mode:
Diffstat (limited to 'zix/trie.c')
-rw-r--r--zix/trie.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/zix/trie.c b/zix/trie.c
index 5083f3b..29f31d1 100644
--- a/zix/trie.c
+++ b/zix/trie.c
@@ -215,7 +215,11 @@ trie_insert_tail(ZixTrieNode** n_ptr,
while (first[0]) {
assert(zix_trie_node_check(*n_ptr));
- c = realloc_node(NULL, 1);
+ c = realloc_node(NULL, 1);
+ if (!c) {
+ return NULL;
+ }
+
c->str = NULL;
c->num_children = 0;
@@ -225,6 +229,11 @@ trie_insert_tail(ZixTrieNode** n_ptr,
++first;
}
+
+ if (!c) {
+ return NULL;
+ }
+
c->num_children = 0;
c->str = str;
assert(zix_trie_node_check(c));