aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib/realloc.c
diff options
context:
space:
mode:
authorStefan Bucur <stefanb@zytor.com>2008-08-14 14:11:55 +0300
committerStefan Bucur <stefan@stefan-ubumac.(none)>2009-03-15 10:10:51 +0200
commit9cc1f4a28bc3abca591528b2a6b9c939c80e6552 (patch)
treeea010e2f12af1d13afacf3c9a59cf584899508c6 /com32/lib/realloc.c
parent3d43756af624dffa27986308dadd0b6acdf99eed (diff)
downloadsyslinux-elf-9cc1f4a28bc3abca591528b2a6b9c939c80e6552.tar.gz
syslinux-elf-9cc1f4a28bc3abca591528b2a6b9c939c80e6552.tar.xz
syslinux-elf-9cc1f4a28bc3abca591528b2a6b9c939c80e6552.zip
Implementing memory tagging support.
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;