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;