Set read node parent through ref

The code was using parent_ref() to set the parent ref's node pointer.
But parent_ref() uses the parent's left node pointer to determine which
ref points to the node.  If we were setting the left it would return the
right because the left isn't set yet.  This messed up the tree shape and
all hell broke loose.

Just set it through the ref, we have it anyway.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2017-04-18 13:44:53 -07:00
parent 157b9294fa
commit a15d37783e
+1 -1
View File
@@ -590,7 +590,7 @@ retry:
memcpy(node->data, tnode->data, bytes);
node->parent = parent;
parent_ref(treap, node)->node = node;
ref->node = node;
ret = 0;
out:
release_ring_node(tnode);