summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mallocx.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mallocx.c b/mallocx.c
index 0a1366a8..4e65fa09 100644
--- a/mallocx.c
+++ b/mallocx.c
@@ -146,7 +146,11 @@ GC_API void * GC_CALL GC_realloc(void * p, size_t lb)
if (orig_sz > lb) {
/* Clear unneeded part of object to avoid bogus pointer */
/* tracing. */
- BZERO(((ptr_t)p) + lb, orig_sz - lb);
+ word cleared_p = (word)p;
+ /* A workaround to avoid passing alloc_size(lb) */
+ /* attribute associated with p to memset. */
+
+ BZERO((ptr_t)cleared_p + lb, orig_sz - lb);
}
return(p);
}