This disables the default leak-check-on-exit behavior which reports a
bunch of leaks that are only leaks while exiting, at which point they
don’t matter, because the operating system will clean up the memory our
process used.
#include <sys/un.h>
#include <i3/ipc.h>
#include <ev.h>
+#ifdef I3_ASAN_ENABLED
+#include <sanitizer/lsan_interface.h>
+#endif
#include "common.h"
/* EOF received. Since i3 will restart i3bar instances as appropriate,
* we exit here. */
DLOG("EOF received, exiting...\n");
+#ifdef I3_ASAN_ENABLED
+ __lsan_do_leak_check();
+#endif
clean_xcb();
exit(EXIT_SUCCESS);
}
#include <X11/XKBlib.h>
#include <X11/extensions/XKB.h>
+#ifdef I3_ASAN_ENABLED
+#include <sanitizer/lsan_interface.h>
+#endif
+
#include "common.h"
#include "libi3.h"
if (xcb_connection_has_error(xcb_connection)) {
ELOG("X11 connection was closed unexpectedly - maybe your X server terminated / crashed?\n");
+#ifdef I3_ASAN_ENABLED
+ __lsan_do_leak_check();
+#endif
exit(1);
}
#include <float.h>
#include <stdarg.h>
+#ifdef I3_ASAN_ENABLED
+#include <sanitizer/lsan_interface.h>
+#endif
+
#include "all.h"
#include "shmlog.h"
*/
void cmd_exit(I3_CMD) {
LOG("Exiting due to user command.\n");
+#ifdef I3_ASAN_ENABLED
+ __lsan_do_leak_check();
+#endif
ipc_shutdown();
unlink(config.ipc_socket_path);
xcb_disconnect(conn);
*/
#include "all.h"
+#ifdef I3_ASAN_ENABLED
+#include <sanitizer/lsan_interface.h>
+#endif
+
typedef struct placeholder_state {
/** The X11 placeholder window. */
xcb_window_t window;
if (restore_conn != NULL) {
xcb_disconnect(restore_conn);
}
+#ifdef I3_ASAN_ENABLED
+ __lsan_do_leak_check();
+#endif
errx(EXIT_FAILURE, "Cannot open display\n");
}