mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-21 09:05:06 +08:00
score: Fix for empty heap
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user