Skip to content

Commit b1fc46a

Browse files
Merge pull request #1176 from lplewa/critnib_fix
add missing nullcheck in critnib
2 parents 692d67a + 96d2ef3 commit b1fc46a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/critnib/critnib.c

+10
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,11 @@ find_predecessor(struct critnib_node *__restrict n) {
537537
}
538538

539539
utils_atomic_load_acquire_ptr((void **)&n->child[nib], (void **)&n);
540+
541+
if (!n) {
542+
return NULL;
543+
}
544+
540545
if (is_leaf(n)) {
541546
return to_leaf(n);
542547
}
@@ -650,6 +655,11 @@ static struct critnib_leaf *find_successor(struct critnib_node *__restrict n) {
650655
}
651656

652657
n = n->child[nib];
658+
659+
if (!n) {
660+
return NULL;
661+
}
662+
653663
if (is_leaf(n)) {
654664
return to_leaf(n);
655665
}

0 commit comments

Comments
 (0)