aboutsummaryrefslogtreecommitdiff
path: root/malloc/hooks.c
diff options
context:
space:
mode:
Diffstat (limited to 'malloc/hooks.c')
-rw-r--r--malloc/hooks.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/malloc/hooks.c b/malloc/hooks.c
index 0c4816f..9303fe5 100644
--- a/malloc/hooks.c
+++ b/malloc/hooks.c
@@ -112,7 +112,8 @@ malloc_check_get_size (mchunkptr p)
if (c <= 0 || size < (c + 2 * SIZE_SZ))
{
malloc_printerr (check_action, "malloc_check_get_size: memory corruption",
- chunk2mem (p));
+ chunk2mem (p),
+ chunk_is_mmapped (p) ? NULL : arena_for_chunk (p));
return 0;
}
}
@@ -237,7 +238,8 @@ top_check (void)
(char *) t + chunksize (t) == mp_.sbrk_base + main_arena.system_mem)))
return 0;
- malloc_printerr (check_action, "malloc: top chunk is corrupt", t);
+ malloc_printerr (check_action, "malloc: top chunk is corrupt", t,
+ &main_arena);
/* Try to set up a new top chunk. */
brk = MORECORE (0);
@@ -295,7 +297,8 @@ free_check (void *mem, const void *caller)
{
(void) mutex_unlock (&main_arena.mutex);
- malloc_printerr (check_action, "free(): invalid pointer", mem);
+ malloc_printerr (check_action, "free(): invalid pointer", mem,
+ &main_arena);
return;
}
if (chunk_is_mmapped (p))
@@ -333,7 +336,8 @@ realloc_check (void *oldmem, size_t bytes, const void *caller)
(void) mutex_unlock (&main_arena.mutex);
if (!oldp)
{
- malloc_printerr (check_action, "realloc(): invalid pointer", oldmem);
+ malloc_printerr (check_action, "realloc(): invalid pointer", oldmem,
+ &main_arena);
return malloc_check (bytes, NULL);
}
const INTERNAL_SIZE_T oldsize = chunksize (oldp);