diff --git a/src/mem.c b/src/mem.c index 8099b6bb7eb8eb0995d2d5672302e18e844661c8..c03c8b3452854b6c82ca2e94cc3b2e4e292377ef 100644 --- a/src/mem.c +++ b/src/mem.c @@ -489,6 +489,12 @@ void *rt_realloc(void *rmem, rt_size_t newsize) { ((struct heap_mem *)&heap_ptr[mem2->next])->prev = ptr2; } + + if (mem2 < lfree) + { + /* the splited struct is now the lowest */ + lfree = mem2; + } plug_holes(mem2);