Merge cadda4ed39
into 3eefa464ee
This commit is contained in:
commit
41a22e9896
2 changed files with 20 additions and 2 deletions
|
@ -8,9 +8,10 @@
|
|||
|
||||
#include <AK/Platform.h>
|
||||
|
||||
#ifdef HAS_ADDRESS_SANITIZER
|
||||
#if defined(HAS_ADDRESS_SANITIZER)
|
||||
# include <sanitizer/lsan_interface.h>
|
||||
|
||||
extern "C" {
|
||||
char const* __lsan_default_suppressions();
|
||||
char const* __lsan_default_suppressions()
|
||||
{
|
||||
// Both Skia and Chromium suppress false positive FontConfig leaks
|
||||
|
@ -20,3 +21,14 @@ char const* __lsan_default_suppressions()
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace AK {
|
||||
|
||||
inline void perform_leak_sanitizer_checks()
|
||||
{
|
||||
#if defined(HAS_ADDRESS_SANITIZER)
|
||||
__lsan_do_leak_check();
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
*/
|
||||
|
||||
#include <AK/Format.h>
|
||||
#include <AK/LsanSuppressions.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
@ -41,10 +43,14 @@ int main(int argc, char** argv)
|
|||
.argv = argv,
|
||||
.strings = arguments.span(),
|
||||
});
|
||||
|
||||
ScopeGuard guard { []() { AK::perform_leak_sanitizer_checks(); } };
|
||||
|
||||
if (result.is_error()) {
|
||||
auto error = result.release_error();
|
||||
warnln("\033[31;1mRuntime error\033[0m: {}", error);
|
||||
return Main::return_code_for_errors();
|
||||
}
|
||||
|
||||
return result.value();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue