diff options
author | rtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-14 23:25:41 +0000 |
---|---|---|
committer | rtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-14 23:25:41 +0000 |
commit | 72cd998240b90ceb9f6fb6f412c8e24acb0fecf8 (patch) | |
tree | 40877baa8565d682cc4c66532128e9d4fdc8fd76 /third_party | |
parent | 09ddb91f6a81adebe023e461387c6510471e6778 (diff) | |
download | chromium_src-72cd998240b90ceb9f6fb6f412c8e24acb0fecf8.zip chromium_src-72cd998240b90ceb9f6fb6f412c8e24acb0fecf8.tar.gz chromium_src-72cd998240b90ceb9f6fb6f412c8e24acb0fecf8.tar.bz2 |
In debug mode, copy the mark (0x36) into all the free'd region.
This could help us to cacth code that is accessing free'd memory.
TEST=None
BUG=78791
R=jar
Review URL: http://codereview.chromium.org/6814038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81668 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/tcmalloc/chromium/src/tcmalloc.cc | 6 |
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. } |