From d4f904b0e784d9e2cbd55415faae1180cfa0f298 Mon Sep 17 00:00:00 2001 From: Keno Fischer Date: Sun, 23 Feb 2014 02:18:33 -0500 Subject: [PATCH] heap: fix node removal --- src/heap-inl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/heap-inl.h b/src/heap-inl.h index 84b9a9d7..907abe65 100644 --- a/src/heap-inl.h +++ b/src/heap-inl.h @@ -219,9 +219,9 @@ HEAP_EXPORT(void heap_remove(struct heap* heap, */ for (;;) { smallest = child; - if (child->left != NULL && less_than(smallest, child)) + if (child->left != NULL && less_than(child->left, smallest)) smallest = child->left; - if (child->right != NULL && less_than(smallest, child)) + if (child->right != NULL && less_than(child->right, smallest)) smallest = child->right; if (smallest == child) break;