From 87bf47894cc14bbe5e21cdaa0df5e2d754e6dc69 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 8 Aug 2013 13:47:50 +0000 Subject: [PATCH] tsan: better diagnostics for invalid addresses passed to free() llvm-svn: 187980 --- compiler-rt/lib/sanitizer_common/sanitizer_allocator.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h index ada1a0c33f47..72b76dcda6f5 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h @@ -1016,7 +1016,10 @@ class LargeMmapAllocator { // At least page_size_/2 metadata bytes is available. void *GetMetaData(const void *p) { // Too slow: CHECK_EQ(p, GetBlockBegin(p)); - CHECK(IsAligned(reinterpret_cast(p), page_size_)); + if (!IsAligned(reinterpret_cast(p), page_size_)) { + Printf("%s: bad pointer %p\n", SanitizerToolName, p); + CHECK(IsAligned(reinterpret_cast(p), page_size_)); + } return GetHeader(p) + 1; } -- 2.34.1