mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-25 00:11:07 +00:00
Add sanity check to AVL tree, fix #597
This commit is contained in:
parent
80ab1bf3ef
commit
0ed8797df2
@ -117,6 +117,9 @@ void Avl_node_base::remove(Policy &policy)
|
|||||||
Avl_node_base *lp = 0;
|
Avl_node_base *lp = 0;
|
||||||
Avl_node_base *l = _child[0];
|
Avl_node_base *l = _child[0];
|
||||||
|
|
||||||
|
if (!_parent)
|
||||||
|
PERR("Error: tried to remove AVL node that is not in an AVL tree");
|
||||||
|
|
||||||
if (l) {
|
if (l) {
|
||||||
|
|
||||||
/* find right-most node in left sub tree (l) */
|
/* find right-most node in left sub tree (l) */
|
||||||
@ -157,6 +160,10 @@ void Avl_node_base::remove(Policy &policy)
|
|||||||
lpp->_rebalance_subtree(lp, policy);
|
lpp->_rebalance_subtree(lp, policy);
|
||||||
lp = lpp;
|
lp = lpp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* reset node pointers */
|
||||||
|
_child[LEFT] = _child[RIGHT] = 0;
|
||||||
|
_parent = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user