summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--third_party/tcmalloc/chromium/src/tcmalloc.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/third_party/tcmalloc/chromium/src/tcmalloc.cc b/third_party/tcmalloc/chromium/src/tcmalloc.cc
index e702256..f0f6aa2 100644
--- a/third_party/tcmalloc/chromium/src/tcmalloc.cc
+++ b/third_party/tcmalloc/chromium/src/tcmalloc.cc
@@ -1737,6 +1737,12 @@ static void ValidateAllocatedRegion(void* ptr, size_t cl) {
DieFromDoubleFree();
if (current_mark != allocated_mark)
DieFromMemoryCorruption();
+#ifndef NDEBUG
+ // In debug mode, copy the mark into all the free'd region.
+ size_t class_size = static_cast<size_t>(reinterpret_cast<char*>(mark) -
+ reinterpret_cast<char*>(ptr));
+ memset(ptr, static_cast<char>(0x36), class_size);
+#endif
*mark = ~allocated_mark; // Distinctively not allocated.
}