binpac: Prevent use of LeakSanitizer on FreeBSD

This commit is contained in:
Jon Siwek 2021-03-12 12:08:10 -08:00 committed by Tim Wojtulewicz
parent f365c253a7
commit 508e78ebe9

View file

@ -220,18 +220,20 @@ void usage()
#endif #endif
#endif #endif
#if defined(USING_ASAN) // FreeBSD doesn't support LeakSanitizer
#if defined(USING_ASAN) && !defined(__FreeBSD__)
#include <sanitizer/lsan_interface.h> #include <sanitizer/lsan_interface.h>
#define BINPAC_LSAN_DISABLE(x) __lsan_disable(x)
#else
#define BINPAC_LSAN_DISABLE(x)
#endif #endif
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
#if defined(USING_ASAN)
// We generally do not care at all if binpac is leaking and other // We generally do not care at all if binpac is leaking and other
// projects that use it, like Zeek, only have their build tripped up // projects that use it, like Zeek, only have their build tripped up
// by the default behavior of LSAN to treat leaks as errors. // by the default behavior of LSAN to treat leaks as errors.
__lsan_disable(); BINPAC_LSAN_DISABLE();
#endif
#ifdef HAVE_MALLOC_OPTIONS #ifdef HAVE_MALLOC_OPTIONS
extern char *malloc_options; extern char *malloc_options;