From ed8627e5358e6bd5b901545c79a4f58c51c838b3 Mon Sep 17 00:00:00 2001 From: Pawel Dziepak Date: Thu, 24 Oct 2013 00:59:58 +0200 Subject: [PATCH] kernel/util: Fix MinMaxHeap::_GrowHeap() --- headers/private/kernel/util/MinMaxHeap.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/headers/private/kernel/util/MinMaxHeap.h b/headers/private/kernel/util/MinMaxHeap.h index 4dc8b0c9f0..14efee5ac8 100644 --- a/headers/private/kernel/util/MinMaxHeap.h +++ b/headers/private/kernel/util/MinMaxHeap.h @@ -335,8 +335,8 @@ MIN_MAX_HEAP_CLASS_NAME::_GrowHeap(int minimalSize) fMinElements = newBuffer; newBuffer += newSize / 2; - if (fMaxElements != NULL) - memcpy(newBuffer, fMaxElements, fSize * sizeof(Element*)); + if (fMaxLastElement > 0) + memcpy(newBuffer, fMinElements + fSize, fSize * sizeof(Element*)); fMaxElements = newBuffer; fSize = newSize / 2; @@ -426,7 +426,7 @@ MIN_MAX_HEAP_CLASS_NAME::_ChangeTree(MinMaxHeapLink* link) if (otherLastElement <= 0) { ASSERT(currentLastElement == 1); - return true; + return false; } ASSERT((link->fIndex - 1) / 2 < otherLastElement);