diff options
author | Mike Frysinger <vapier@gentoo.org> | 2015-08-18 11:09:28 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2015-08-18 11:11:42 -0400 |
commit | 51d892de53b850467de615774c2d26de007db649 (patch) | |
tree | ff9166a3649599f1c4e2052c5b2622c1e23b5142 /porting.h | |
parent | build: use pkg-config for libcap settings (diff) | |
download | pax-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.h | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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 */ |