]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
* malloc.c (struct malloc_chunk): Fix comment typo.
authorJakub Jelinek <jakub@redhat.com>
Mon, 12 Sep 2005 09:39:03 +0000 (09:39 +0000)
committerJakub Jelinek <jakub@redhat.com>
Mon, 12 Sep 2005 09:39:03 +0000 (09:39 +0000)
(public_cALLOc): For mmapped chunks and perturb_byte != 0,
don't clear SIZE_SZ bytes more than should be cleared.

ChangeLog
malloc/malloc.c

index 9d0d99ab99ae54b433f3985e9a9c5734033a64b0..fe2a06010b458bf489df08e75e382a984bba231d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-09-12  Jakub Jelinek  <jakub@redhat.com>
+
+       * malloc.c (struct malloc_chunk): Fix comment typo.
+       (public_cALLOc): For mmapped chunks and perturb_byte != 0,
+       don't clear SIZE_SZ bytes more than should be cleared.
+
 2005-09-09  Jakub Jelinek  <jakub@redhat.com>
 
        * inet/getnetgrent_r.c: Include assert.
index 65be2770974cb4447f0172e3c44f249395698810..64050b42663f41ebb699f6c8b448aaafb0e858b2 100644 (file)
@@ -1726,7 +1726,7 @@ struct malloc_chunk {
       mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
             |             User data starts here...                          .
             .                                                               .
-            .             (malloc_usable_space() bytes)                     .
+            .             (malloc_usable_size() bytes)                      .
             .                                                               |
 nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
             |             Size of chunk                                     |
@@ -3691,8 +3691,12 @@ public_cALLOc(size_t n, size_t elem_size)
 
   /* Two optional cases in which clearing not necessary */
 #if HAVE_MMAP
-  if (perturb_byte == 0 && chunk_is_mmapped(p))
-    return mem;
+  if (chunk_is_mmapped (p))
+    {
+      if (__builtin_expect (perturb_byte, 0))
+       MALLOC_ZERO (mem, sz);
+      return mem;
+    }
 #endif
 
   csz = chunksize(p);