Disable the internal memory allocator when AddressSanitizer is in use.
The basic blocks in the internal memory allocator prevents
AddressSanitizer from properly tracking the allocations and
deallocations, so we need to ensure it has been disabled for any build
that has AddressSanitizer enabled.
#include <isc/mutex.h>
#include <isc/platform.h>
#include <isc/types.h>
+#include <isc/util.h>
ISC_LANG_BEGINDECLS
* by carefully separating memory contexts.
*/
-#ifndef ISC_MEM_USE_INTERNAL_MALLOC
+#if !defined(ISC_MEM_USE_INTERNAL_MALLOC) && !__SANITIZE_ADDRESS__
#define ISC_MEM_USE_INTERNAL_MALLOC 1
#endif /* ifndef ISC_MEM_USE_INTERNAL_MALLOC */
static void
mem_create(isc_mem_t **ctxp, unsigned int flags) {
REQUIRE(ctxp != NULL && *ctxp == NULL);
+#if __SANITIZE_ADDRESS__
+ REQUIRE((flags & ISC_MEMFLAG_INTERNAL) == 0);
+#endif
isc__mem_t *ctx;