[ASan] Clear allocation magic value before recycling the chunk. This led to spurious crashes in LSan when it walked through reused chunks. Don't know how to create not-brittle test case for this.

llvm-svn: 184404
This commit is contained in:
Alexey Samsonov 2013-06-20 08:13:06 +00:00
parent cb0b876b39
commit 686c229b03
1 changed files with 3 additions and 0 deletions

View File

@ -280,6 +280,9 @@ struct QuarantineCallback {
if (p != m) {
uptr *alloc_magic = reinterpret_cast<uptr *>(p);
CHECK_EQ(alloc_magic[0], kAllocBegMagic);
// Clear the magic value, as allocator internals may overwrite the
// contents of deallocated chunk, confusing GetAsanChunk lookup.
alloc_magic[0] = 0;
CHECK_EQ(alloc_magic[1], reinterpret_cast<uptr>(m));
}