From fbddbf36a2d15903547055bee3fb8cd747ee96dc Mon Sep 17 00:00:00 2001 From: Not Zed Date: Tue, 23 Jul 2024 18:53:01 +0930 Subject: [PATCH] Initialise both links for new node. Caught with valgrind. --- ez-tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ez-tree.c b/ez-tree.c index 6fcfb08..04a3529 100644 --- a/ez-tree.c +++ b/ez-tree.c @@ -285,8 +285,9 @@ void *ez_tree_put(ez_tree *tree, void *node) { struct ez_tree_scan_info *sp = stack, *se = sp + EZ_TREE_MAX_DEPTH - 1; ez_cmp_fn node_cmp = tree->node_cmp; + // Initialise incoming node k->link[0] = BALANCE0; // balance=0 - node_set_link(k, 1, 0); + k->link[1] = BALANCE0; if (!tree->root.link[1]) { tree->root.link[1] = (intptr_t)k; -- 2.39.2