From a15d37783ef8c3deba7b6e15ab23658d4ff091d0 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 3 Jan 2017 15:56:53 -0800 Subject: [PATCH] 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 --- kmod/src/treap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmod/src/treap.c b/kmod/src/treap.c index 3e241298..d92511de 100644 --- a/kmod/src/treap.c +++ b/kmod/src/treap.c @@ -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);