[libcxx-commits] [libcxxabi] a4538cd - [libc++abi] Don't leak in test (#119505)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 10 22:02:35 PST 2024


Author: Vitaly Buka
Date: 2024-12-10T22:02:32-08:00
New Revision: a4538cdcee75b78b7165dda05c9aa7718c4837c4

URL: https://github.com/llvm/llvm-project/commit/a4538cdcee75b78b7165dda05c9aa7718c4837c4
DIFF: https://github.com/llvm/llvm-project/commit/a4538cdcee75b78b7165dda05c9aa7718c4837c4.diff

LOG: [libc++abi] Don't leak in test (#119505)

Trying to re-enable a test on bots

https://github.com/llvm/llvm-zorg/blob/bb695735dba75e1a5dced13e836f4f46de464bac/zorg/buildbot/builders/sanitizers/buildbot_functions.sh#L443

When we reach `terminate()` `exc` pointer is not
on the stack, so lsan correctly reports a leak.

Added: 
    

Modified: 
    libcxxabi/test/forced_unwind2.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxxabi/test/forced_unwind2.pass.cpp b/libcxxabi/test/forced_unwind2.pass.cpp
index 6ec27e4a655577..edd0a3b175f06e 100644
--- a/libcxxabi/test/forced_unwind2.pass.cpp
+++ b/libcxxabi/test/forced_unwind2.pass.cpp
@@ -44,10 +44,8 @@ struct Stop<R (*)(Args...)> {
 };
 
 static void forced_unwind() {
-  _Unwind_Exception* exc = new _Unwind_Exception;
-  memset(&exc->exception_class, 0, sizeof(exc->exception_class));
-  exc->exception_cleanup = 0;
-  _Unwind_ForcedUnwind(exc, Stop<_Unwind_Stop_Fn>::stop, 0);
+  static _Unwind_Exception exc = {};
+  _Unwind_ForcedUnwind(&exc, Stop<_Unwind_Stop_Fn>::stop, 0);
   abort();
 }
 


        


More information about the libcxx-commits mailing list