summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cpukit/score/src/heapgreedy.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/cpukit/score/src/heapgreedy.c b/cpukit/score/src/heapgreedy.c
index 34ac811951..615d3066cf 100644
--- a/cpukit/score/src/heapgreedy.c
+++ b/cpukit/score/src/heapgreedy.c
@@ -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 );
}