Move isc_mem_put to after node is checked for equality

isc_mem_put NULL's the pointer to the memory being freed.  The
equality test 'parent->r == node' was accidentally being turned
into a test against NULL.

(cherry picked from commit ac2e0bc3ff)
This commit is contained in:
Mark Andrews 2023-05-26 10:28:39 +10:00
parent 9a1d565f07
commit 27eb8ed20f

View file

@ -694,13 +694,13 @@ isc_radix_remove(isc_radix_tree_t *radix, isc_radix_node_t *node) {
return;
}
isc_mem_put(radix->mctx, node, sizeof(*node));
radix->num_active_node--;
if (parent->r == node) {
parent->r = child;
} else {
INSIST(parent->l == node);
parent->l = child;
}
isc_mem_put(radix->mctx, node, sizeof(*node));
radix->num_active_node--;
}