Prevent massive end-of-process leak sanitizer dump

This commit is contained in:
Janek Bevendorff 2017-03-14 15:32:48 +01:00
parent 28ec015ef4
commit 504bd40263
No known key found for this signature in database
GPG Key ID: CFEC2F6850BFFA53
2 changed files with 15 additions and 3 deletions

View File

@ -85,7 +85,7 @@ add_gcc_compiler_cxxflags("-fno-exceptions -fno-rtti")
add_gcc_compiler_cxxflags("-Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual")
add_gcc_compiler_cflags("-Wchar-subscripts -Wwrite-strings")
if(WITH_ASAN)
add_gcc_compiler_flags("-fsanitize=address")
add_gcc_compiler_flags("-fsanitize=address -DWITH_ASAN")
endif()
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)

View File

@ -28,6 +28,10 @@
#include "gui/MainWindow.h"
#include "gui/MessageBox.h"
#ifdef WITH_ASAN
#include <sanitizer/lsan_interface.h>
#endif
#ifdef QT_STATIC
#include <QtPlugin>
@ -130,6 +134,14 @@ int main(int argc, char** argv)
}
}
}
return app.exec();
int exitCode = app.exec();
#ifdef WITH_ASAN
// do leak check here to prevent massive tail of end-of-process leak errors from third-party libraries
__lsan_do_leak_check();
__lsan_disable();
#endif
return exitCode;
}