aboutsummaryrefslogtreecommitdiff
path: root/main.h
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2016-12-28 17:54:08 -0500
committerMike Frysinger <vapier@gentoo.org>2016-12-28 17:54:08 -0500
commit8f6a879b16fc664b03c361ae203def52220d0cb9 (patch)
treecb541a9806018a2fa85c2a1b04727a1e98982aa0 /main.h
parentstart some likely/unlikely helpers (diff)
downloadportage-utils-8f6a879b16fc664b03c361ae203def52220d0cb9.tar.gz
portage-utils-8f6a879b16fc664b03c361ae203def52220d0cb9.tar.bz2
portage-utils-8f6a879b16fc664b03c361ae203def52220d0cb9.zip
add cleanup logic to handle specific leaks
There's a few code paths that we leak resources because we know we're exiting (soon). Add some logic to avoid false positives.
Diffstat (limited to 'main.h')
-rw-r--r--main.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/main.h b/main.h
index 6848a9fc..d3df8b1d 100644
--- a/main.h
+++ b/main.h
@@ -95,6 +95,19 @@
# define IF_DEBUG(x)
#endif
+#undef USE_CLEANUP
+/* LSAN (Leak Sanitizer) will complain about things we leak. */
+#ifdef __SANITIZE_ADDRESS__
+# define USE_CLEANUP 1
+#endif
+/* Coverity catches some things we leak on purpose. */
+#ifdef __COVERITY__
+# define USE_CLEANUP 1
+#endif
+#ifndef USE_CLEANUP
+# define USE_CLEANUP 0
+#endif
+
#define GETOPT_LONG(A, a, ex) \
getopt_long(argc, argv, ex A ## _FLAGS, a ## _long_opts, NULL)