aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--malloc/mtrace.c9
2 files changed, 13 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 8f46eba3ee..2611e75814 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-01-03 Andreas Schwab <schwab@linux-m68k.org>
+
+ [BZ #14981]
+ * malloc/mtrace.c (tr_reallochook): If realloc returns NULL when
+ size is zero, record memory as freed.
+
2013-01-03 Andreas Jaeger <aj@suse.de>
* po/ia.po: Add new Interlingua translation.
diff --git a/malloc/mtrace.c b/malloc/mtrace.c
index af3b7f8ada..e9ccfa299d 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