score: Fix for empty heap

This commit is contained in:
Sebastian Huber
2014-04-07 16:48:02 +02:00
parent fef4293834
commit d61c315575
+6 -1
View File
@@ -83,7 +83,12 @@ Heap_Block *_Heap_Greedy_allocate_all_except_largest(
Heap_Information info;
_Heap_Get_free_information( heap, &info );
*allocatable_size = info.largest - HEAP_BLOCK_HEADER_SIZE + HEAP_ALLOC_BONUS;
if ( info.largest > 0 ) {
*allocatable_size = info.largest - HEAP_BLOCK_HEADER_SIZE + HEAP_ALLOC_BONUS;
} else {
*allocatable_size = 0;
}
return _Heap_Greedy_allocate( heap, allocatable_size, 1 );
}