diff options
| author | greed-island <[email protected]> | 2020-03-27 18:57:29 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-03-27 18:57:29 +0800 |
| commit | b082876c9b06d8a883726e6ddec50c2b49b6c4da (patch) | |
| tree | 4d1cb3e7edd84560324ffce7c0cdae09cda4076f /src | |
| parent | 7f6755c622fd76394f0496752d7b33846f19ebe8 (diff) | |
Update mem.c
rt_realloc may cause <lfree> change, if we don't change <lfree> timely, it may cause memory leakage
Diffstat (limited to 'src')
| -rw-r--r-- | src/mem.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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); |
