mm: fix realloc overwrite memcpy when use a new block

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2021-10-26 16:10:39 +08:00 committed by Xiang Xiao
parent b1879d5d24
commit 3615592e82
1 changed files with 1 additions and 1 deletions

View File

@ -355,7 +355,7 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
newmem = (FAR void *)mm_malloc(heap, size);
if (newmem)
{
memcpy(newmem, oldmem, oldsize);
memcpy(newmem, oldmem, oldsize - SIZEOF_MM_ALLOCNODE);
mm_free(heap, oldmem);
}