aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-08-18 11:09:28 -0400
committerMike Frysinger <vapier@gentoo.org>2015-08-18 11:11:42 -0400
commit51d892de53b850467de615774c2d26de007db649 (patch)
treeff9166a3649599f1c4e2052c5b2622c1e23b5142 /porting.h
parentbuild: use pkg-config for libcap settings (diff)
downloadpax-utils-51d892de53b850467de615774c2d26de007db649.tar.gz
pax-utils-51d892de53b850467de615774c2d26de007db649.tar.bz2
pax-utils-51d892de53b850467de615774c2d26de007db649.zip
debug: improve cleanup logic
Always set up the cleanup symbol and use it at C time rather than CPP. We can delete the warning code since we clean those strings up now. Add ASAN support so LSAN doesn't complain either. Fix a bug in the leak checking when the -F flag is used -- normally we don't allocate that string but set it to one of the argv constants.
Diffstat (limited to 'porting.h')
-rw-r--r--porting.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/porting.h b/porting.h
index 5bbaa77..1f989d2 100644
--- a/porting.h
+++ b/porting.h
@@ -16,7 +16,6 @@
#endif
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(*arr))
-#undef __PAX_UTILS_CLEANUP
#include <assert.h>
#include <ctype.h>
@@ -66,12 +65,20 @@
# define __PAX_UTILS_DEFAULT_LD_CACHE_CONFIG ""
#endif
+#undef PAX_UTILS_CLEANUP
/* bounds checking code will fart on free(NULL) even though that
* is valid usage. So let's wrap it if need be.
*/
#ifdef __BOUNDS_CHECKING_ON
# define free(ptr) do { if (ptr) free(ptr); } while (0)
-# define __PAX_UTILS_CLEANUP
+# define PAX_UTILS_CLEANUP 1
+#endif
+/* LSAN (Leak Sanitizer) will complain about things we leak. */
+#ifdef __SANITIZE_ADDRESS__
+# define PAX_UTILS_CLEANUP 1
+#endif
+#ifndef PAX_UTILS_CLEANUP
+# define PAX_UTILS_CLEANUP 0
#endif
/* Few arches can safely do unaligned accesses */