[HWASAN][LSAN] Only initialize Symbolizer if leak checking is enabled
authorKirill Stoimenov <kstoimenov@google.com>
Thu, 23 Feb 2023 20:30:53 +0000 (20:30 +0000)
committerKirill Stoimenov <kstoimenov@google.com>
Thu, 23 Feb 2023 21:38:59 +0000 (21:38 +0000)
Reviewed By: hctim

Differential Revision: https://reviews.llvm.org/D144669

compiler-rt/lib/hwasan/hwasan.cpp

index b7a95ca..662cfb4 100644 (file)
@@ -400,11 +400,9 @@ __attribute__((constructor(0))) void __hwasan_init() {
   __ubsan::InitAsPlugin();
 #endif
 
-  if (CAN_SANITIZE_LEAKS) {
+  if (CAN_SANITIZE_LEAKS && common_flags()->detect_leaks) {
     __lsan::ScopedInterceptorDisabler disabler;
     Symbolizer::LateInitialize();
-  } else {
-    Symbolizer::LateInitialize();
   }
 
   VPrintf(1, "HWAddressSanitizer init done\n");