This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] malloc_usable_size: Use correct size for dumped fake mapped chunks


The adjustment for the size computation in commit
1e8a8875d69e36d2890b223ffe8853a8ff0c9512 is needed in
malloc_usable_size, too.

2016-06-10  Florian Weimer  <fweimer@redhat.com>

	* malloc/malloc.c (musable): Return correct size for dumped fake
	mmapped chunk.

diff --git a/malloc/malloc.c b/malloc/malloc.c
index 6f77d37..a077335 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -4608,7 +4608,12 @@ musable (void *mem)
         return malloc_check_get_size (p);
 
       if (chunk_is_mmapped (p))
-        return chunksize (p) - 2 * SIZE_SZ;
+	{
+	  if (DUMPED_MAIN_ARENA_CHUNK (p))
+	    return chunksize (p) - SIZE_SZ;
+	  else
+	    return chunksize (p) - 2 * SIZE_SZ;
+	}
       else if (inuse (p))
         return chunksize (p) - SIZE_SZ;
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]