diff options
Diffstat (limited to 'lib/lsan/lsan_allocator.cc')
-rw-r--r-- | lib/lsan/lsan_allocator.cc | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/lib/lsan/lsan_allocator.cc b/lib/lsan/lsan_allocator.cc index 08b8fbd04..bf2c2e553 100644 --- a/lib/lsan/lsan_allocator.cc +++ b/lib/lsan/lsan_allocator.cc @@ -44,8 +44,6 @@ typedef CombinedAllocator<PrimaryAllocator, AllocatorCache, static Allocator allocator; static THREADLOCAL AllocatorCache cache; -// All allocations made while this is > 0 will be treated as non-leaks. -static THREADLOCAL uptr lsan_disabled; void InitializeAllocator() { allocator.Init(); @@ -63,7 +61,7 @@ static void RegisterAllocation(const StackTrace &stack, void *p, uptr size) { if (!p) return; ChunkMetadata *m = Metadata(p); CHECK(m); - m->tag = lsan_disabled ? kIgnored : kDirectlyLeaked; + m->tag = DisabledInThisThread() ? kIgnored : kDirectlyLeaked; m->stack_trace_id = StackDepotPut(stack.trace, stack.size); m->requested_size = size; atomic_store((atomic_uint8_t*)m, 1, memory_order_relaxed); @@ -188,8 +186,8 @@ template void ForEachChunk<PrintLeakedCb>(PrintLeakedCb const &callback); template void ForEachChunk<CollectLeaksCb>(CollectLeaksCb const &callback); template void ForEachChunk<MarkIndirectlyLeakedCb>( MarkIndirectlyLeakedCb const &callback); -template void ForEachChunk<CollectSuppressedCb>( - CollectSuppressedCb const &callback); +template void ForEachChunk<CollectIgnoredCb>( + CollectIgnoredCb const &callback); IgnoreObjectResult IgnoreObjectLocked(const void *p) { void *chunk = allocator.GetBlockBegin(p); @@ -206,20 +204,3 @@ IgnoreObjectResult IgnoreObjectLocked(const void *p) { } } } // namespace __lsan - -extern "C" { -SANITIZER_INTERFACE_ATTRIBUTE -void __lsan_disable() { - __lsan::lsan_disabled++; -} - -SANITIZER_INTERFACE_ATTRIBUTE -void __lsan_enable() { - if (!__lsan::lsan_disabled) { - Report("Unmatched call to __lsan_enable().\n"); - Die(); - } - __lsan::lsan_disabled--; -} -} // extern "C" - |