summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h
diff options
context:
space:
mode:
authorSergey Matveev <earthdok@google.com>2013-11-24 14:45:38 +0000
committerSergey Matveev <earthdok@google.com>2013-11-24 14:45:38 +0000
commit634a75b63e426db33dd1df3b6f4822acf8bc364e (patch)
tree777759cbe749a45eedc36f6b25105a41dc306e0e /compiler-rt/lib/sanitizer_common/sanitizer_allocator.h
parent10548681c05db944e730e20137996e847e887061 (diff)
downloadbcm5719-llvm-634a75b63e426db33dd1df3b6f4822acf8bc364e.tar.gz
bcm5719-llvm-634a75b63e426db33dd1df3b6f4822acf8bc364e.zip
[sanitizer] Do not clear memory which comes from secondary allocator.
Secondary allocator is mmap-based, so the memory is already zeroed. llvm-svn: 195571
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_allocator.h')
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_allocator.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h
index 81e40ed1516..5ea1edbc798 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h
@@ -1184,13 +1184,14 @@ class CombinedAllocator {
if (alignment > 8)
size = RoundUpTo(size, alignment);
void *res;
- if (primary_.CanAllocate(size, alignment))
+ bool from_primary = primary_.CanAllocate(size, alignment);
+ if (from_primary)
res = cache->Allocate(&primary_, primary_.ClassID(size));
else
res = secondary_.Allocate(&stats_, size, alignment);
if (alignment > 8)
CHECK_EQ(reinterpret_cast<uptr>(res) & (alignment - 1), 0);
- if (cleared && res)
+ if (cleared && res && from_primary)
internal_bzero_aligned16(res, RoundUpTo(size, 16));
return res;
}
OpenPOWER on IntegriCloud