aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib/realloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'com32/lib/realloc.c')
-rw-r--r--com32/lib/realloc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/com32/lib/realloc.c b/com32/lib/realloc.c
index a9b0ca4e..ed7fc4c0 100644
--- a/com32/lib/realloc.c
+++ b/com32/lib/realloc.c
@@ -58,6 +58,7 @@ void *realloc(void *ptr, size_t size)
nah = (struct free_arena_header *)((char *)ah + newsize);
ARENA_TYPE_SET(nah->a.attrs, ARENA_TYPE_FREE);
ARENA_SIZE_SET(nah->a.attrs, xsize - newsize);
+ nah->a.tag = NULL;
ARENA_SIZE_SET(ah->a.attrs, newsize);
/* Insert into block list */
@@ -91,6 +92,8 @@ void *realloc(void *ptr, size_t size)
newptr = malloc(size);
if (newptr) {
memcpy(newptr, ptr, min(size,oldsize));
+ /* Retain tag from the old block */
+ __mem_set_tag(newptr, __mem_get_tag(ptr));
free(ptr);
}
return newptr;