[compiler-rt] r183218 - [asan] Fix invalid thread registry access when checking if LSan is disabled.

Sergey Matveev earthdok at google.com
Tue Jun 4 03:39:24 PDT 2013


Author: smatveev
Date: Tue Jun  4 05:39:24 2013
New Revision: 183218

URL: http://llvm.org/viewvc/llvm-project?rev=183218&view=rev
Log:
[asan] Fix invalid thread registry access when checking if LSan is disabled.

Modified:
    compiler-rt/trunk/lib/asan/asan_allocator2.cc

Modified: compiler-rt/trunk/lib/asan/asan_allocator2.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator2.cc?rev=183218&r1=183217&r2=183218&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_allocator2.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_allocator2.cc Tue Jun  4 05:39:24 2013
@@ -422,8 +422,10 @@ static void *Allocate(uptr size, uptr al
     uptr fill_size = Min(size, (uptr)fl.max_malloc_fill_size);
     REAL(memset)(res, fl.malloc_fill_byte, fill_size);
   }
-  m->lsan_tag =
-      t->lsan_disabled() ? __lsan::kSuppressed : __lsan::kDirectlyLeaked;
+  if (t && t->lsan_disabled())
+    m->lsan_tag = __lsan::kSuppressed;
+  else
+    m->lsan_tag = __lsan::kDirectlyLeaked;
   // Must be the last mutation of metadata in this function.
   atomic_store((atomic_uint8_t *)m, CHUNK_ALLOCATED, memory_order_release);
   ASAN_MALLOC_HOOK(res, size);





More information about the llvm-commits mailing list