summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-03-20 18:09:53 +0000
committerUlrich Drepper <drepper@redhat.com>2005-03-20 18:09:53 +0000
commit56137dbc2df4527d78e096999f08e10be9577ea3 (patch)
tree926c426322f168f2255a7ec9b4aeed5793ffb67e
parent65fb0d218921092f04d47db1c686951764da927b (diff)
* malloc/malloc.c (public_cALLOc): We cannot skip the memory
clearing if perturb_byte != 0.
-rw-r--r--ChangeLog5
-rw-r--r--malloc/malloc.c6
2 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index db2267f60d..492e1479f5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-03-20 Ulrich Drepper <drepper@redhat.com>
+
+ * malloc/malloc.c (public_cALLOc): We cannot skip the memory
+ clearing if perturb_byte != 0.
+
2005-03-20 Jakub Jelinek <jakub@redhat.com>
* posix/bits/unistd.h (pread) [__USE_FILE_OFFSET64]: Use __off64_t
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 44831bbb1d..65be277097 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1,4 +1,4 @@
- /* Malloc implementation for multiple threads without lock contention.
+/* Malloc implementation for multiple threads without lock contention.
Copyright (C) 1996-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Wolfram Gloger <wg@malloc.de>
@@ -3691,14 +3691,14 @@ public_cALLOc(size_t n, size_t elem_size)
/* Two optional cases in which clearing not necessary */
#if HAVE_MMAP
- if (chunk_is_mmapped(p))
+ if (perturb_byte == 0 && chunk_is_mmapped(p))
return mem;
#endif
csz = chunksize(p);
#if MORECORE_CLEARS
- if (p == oldtop && csz > oldtopsize) {
+ if (perturb_byte == 0 && (p == oldtop && csz > oldtopsize)) {
/* clear only the bytes from non-freshly-sbrked memory */
csz = oldtopsize;
}