summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.clang-tidy1
-rw-r--r--wscript1
-rw-r--r--zix/btree.c6
-rw-r--r--zix/trie.c11
4 files changed, 14 insertions, 5 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 17b9b27..84771ad 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -9,7 +9,6 @@ Checks: >
-cert-err34-c,
-cert-msc30-c,
-cert-msc50-cpp,
- -clang-analyzer-core.NullDereference,
-cppcoreguidelines-init-variables,
-google-readability-casting,
-hicpp-multiway-paths-covered,
diff --git a/wscript b/wscript
index a69ffb8..858bd51 100644
--- a/wscript
+++ b/wscript
@@ -59,7 +59,6 @@ def configure(conf):
'-Wno-cast-align',
'-Wno-conversion',
'-Wno-inline',
- '-Wno-null-dereference',
'-Wno-padded',
'-Wno-suggest-attribute=const',
'-Wno-suggest-attribute=pure',
diff --git a/zix/btree.c b/zix/btree.c
index dc8f32b..55d6613 100644
--- a/zix/btree.c
+++ b/zix/btree.c
@@ -593,8 +593,10 @@ zix_btree_remove(ZixBTree* const t,
n->children[1]->n_vals};
n = zix_btree_merge(t, n, 0);
- ti->stack[ti->level].node = n;
- ti->stack[ti->level].index = counts[i];
+ if (ti) {
+ ti->stack[ti->level].node = n;
+ ti->stack[ti->level].index = counts[i];
+ }
} else {
// Both child's siblings are minimal, merge them
if (i < n->n_vals) {
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));