static int lsan_test_pipe[2] = {-1, -1};
static int lsan_test_pid = -1;
static int lsan_state = INT_MAX;
+static bool lsan_disable = false; //!< Explicitly disable LSAN
/*
* Some versions of lsan_interface.h are broken and don't declare
{
uint8_t ret = 1;
+ /* Disable LSAN explicitly - Used for tests involving fork() */
+ if (lsan_disable) return 1;
+
/* Parent */
if (lsan_test_pid != 0) return 0;
int ppid = getppid();
int flags;
+ /*
+ * Disable the leak checker for this forked process
+ * so we don't get spurious leaks reported.
+ */
+ lsan_disable = true;
+
DIAG_OFF(deprecated-declarations);
flags = PT_ATTACH;
DIAG_ON(deprecated-declarations);