Assign and then check node for NULL to address another thread
changing radix->head in the meantime.
Move 'node != NULL' check into while loop test to silence cppcheck
false positive.
Fix pointer != NULL style.
*target = NULL;
- if (radix->head == NULL) {
+ node = radix->head;
+
+ if (node == NULL) {
return (ISC_R_NOTFOUND);
}
- node = radix->head;
addr = isc_prefix_touchar(prefix);
bitlen = prefix->bitlen;
- while (node->bit < bitlen) {
+ while (node != NULL && node->bit < bitlen) {
if (node->prefix) {
stack[cnt++] = node;
}
} else {
node = node->l;
}
-
- if (node == NULL) {
- break;
- }
}
- if (node && node->prefix) {
+ if (node != NULL && node->prefix) {
stack[cnt++] = node;
}