mm: fix realloc overwrite memcpy when use a new block
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
parent
b1879d5d24
commit
3615592e82
@ -355,7 +355,7 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
|
|||||||
newmem = (FAR void *)mm_malloc(heap, size);
|
newmem = (FAR void *)mm_malloc(heap, size);
|
||||||
if (newmem)
|
if (newmem)
|
||||||
{
|
{
|
||||||
memcpy(newmem, oldmem, oldsize);
|
memcpy(newmem, oldmem, oldsize - SIZEOF_MM_ALLOCNODE);
|
||||||
mm_free(heap, oldmem);
|
mm_free(heap, oldmem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user