aboutsummaryrefslogtreecommitdiff
path: root/malloc/mtrace.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2012-12-22 17:24:44 +0100
committerAndreas Schwab <schwab@linux-m68k.org>2013-01-03 11:18:04 +0100
commit2f5f40f465c5c1af651727e756fd007fd11f2236 (patch)
treead9f3b9459925b440ec1537ecba5fc5286c8d323 /malloc/mtrace.c
parent4056f4a03a524c94bdd02515e855043c8bb041d2 (diff)
downloadglibc-2f5f40f465c5c1af651727e756fd007fd11f2236.zip
glibc-2f5f40f465c5c1af651727e756fd007fd11f2236.tar.gz
glibc-2f5f40f465c5c1af651727e756fd007fd11f2236.tar.bz2
mtrace: properly handle realloc (p, 0)
Diffstat (limited to 'malloc/mtrace.c')
-rw-r--r--malloc/mtrace.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/malloc/mtrace.c b/malloc/mtrace.c
index af3b7f8..e9ccfa2 100644
--- a/malloc/mtrace.c
+++ b/malloc/mtrace.c
@@ -219,8 +219,13 @@ tr_reallochook (ptr, size, caller)
tr_where (caller, info);
if (hdr == NULL)
- /* Failed realloc. */
- fprintf (mallstream, "! %p %#lx\n", ptr, (unsigned long int) size);
+ {
+ if (size != 0)
+ /* Failed realloc. */
+ fprintf (mallstream, "! %p %#lx\n", ptr, (unsigned long int) size);
+ else
+ fprintf (mallstream, "- %p\n", ptr);
+ }
else if (ptr == NULL)
fprintf (mallstream, "+ %p %#lx\n", hdr, (unsigned long int) size);
else