[NFC][asan] Don't unwind stack before pool check
authorVitaly Buka <vitalybuka@google.com>
Fri, 28 Aug 2020 08:59:27 +0000 (01:59 -0700)
committerVitaly Buka <vitalybuka@google.com>
Fri, 28 Aug 2020 09:00:35 +0000 (02:00 -0700)
compiler-rt/lib/asan/asan_malloc_linux.cpp

index faa8968..cb6c0ce 100644 (file)
@@ -120,19 +120,19 @@ static void *ReallocFromLocalPool(void *ptr, uptr size) {
 }
 
 INTERCEPTOR(void, free, void *ptr) {
-  GET_STACK_TRACE_FREE;
   if (UNLIKELY(IsInDlsymAllocPool(ptr))) {
     DeallocateFromLocalPool(ptr);
     return;
   }
+  GET_STACK_TRACE_FREE;
   asan_free(ptr, &stack, FROM_MALLOC);
 }
 
 #if SANITIZER_INTERCEPT_CFREE
 INTERCEPTOR(void, cfree, void *ptr) {
-  GET_STACK_TRACE_FREE;
   if (UNLIKELY(IsInDlsymAllocPool(ptr)))
     return;
+  GET_STACK_TRACE_FREE;
   asan_free(ptr, &stack, FROM_MALLOC);
 }
 #endif // SANITIZER_INTERCEPT_CFREE
@@ -304,4 +304,4 @@ void ReplaceSystemMalloc() {
 #endif  // SANITIZER_ANDROID
 
 #endif  // SANITIZER_FREEBSD || SANITIZER_FUCHSIA || SANITIZER_LINUX ||
-        // SANITIZER_NETBSD || SANITIZER_SOLARIS
+        // SANITIZER_NETBSD || SANITIZER_SOLARIS
\ No newline at end of file