From 2c5e3bf401fa46ca2545820a68b4c2b5c1ee1bce Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Tue, 19 Jul 2016 16:53:49 -0400 Subject: [PATCH] Fix trace window unmapping bug We were recording window number, not trace count, resulting in windows not getting unmapped. --- malloc/malloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/malloc/malloc.c b/malloc/malloc.c index 82608e16c69..beaff40890c 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -1206,7 +1206,7 @@ __mtb_trace_entry (uint32_t type, size_t size, void *ptr1) counter for the current thread window. */ if (__malloc_trace_last_num != -1) { - int old_window = TRACE_COUNT_TO_MAPPING_NUM (__malloc_trace_last_num); + int old_window = __malloc_trace_last_num; int old_ref_count = catomic_exchange_and_add (&__malloc_trace_buffer[old_window].ref_count, -1); /* W3. If that reference counter reached 0, unmap the window. */ if (old_ref_count == 1) -- 2.47.2