Merge pull request #3489 from greed-island/mem
fix bug in rt_realloc of mem.c, which may cause memory leak
This commit is contained in:
commit
0930683a3f
@ -490,6 +490,12 @@ void *rt_realloc(void *rmem, rt_size_t newsize)
|
|||||||
((struct heap_mem *)&heap_ptr[mem2->next])->prev = ptr2;
|
((struct heap_mem *)&heap_ptr[mem2->next])->prev = ptr2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mem2 < lfree)
|
||||||
|
{
|
||||||
|
/* the splited struct is now the lowest */
|
||||||
|
lfree = mem2;
|
||||||
|
}
|
||||||
|
|
||||||
plug_holes(mem2);
|
plug_holes(mem2);
|
||||||
|
|
||||||
rt_sem_release(&heap_sem);
|
rt_sem_release(&heap_sem);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user