Skip to content

Commit a4538cd

Browse files
authored
[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.
1 parent acaa5fa commit a4538cd

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

libcxxabi/test/forced_unwind2.pass.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,8 @@ struct Stop<R (*)(Args...)> {
4444
};
4545

4646
static void forced_unwind() {
47-
_Unwind_Exception* exc = new _Unwind_Exception;
48-
memset(&exc->exception_class, 0, sizeof(exc->exception_class));
49-
exc->exception_cleanup = 0;
50-
_Unwind_ForcedUnwind(exc, Stop<_Unwind_Stop_Fn>::stop, 0);
47+
static _Unwind_Exception exc = {};
48+
_Unwind_ForcedUnwind(&exc, Stop<_Unwind_Stop_Fn>::stop, 0);
5149
abort();
5250
}
5351

0 commit comments

Comments
 (0)