Issue 102: Fix ASAN build when using GCC.

GCC's address sanitizer sets the __SANITIZE_ADDRESS__ macro instead.
This commit is contained in:
Tor Andersson
2019-06-12 17:23:38 +02:00
parent e2b59201d5
commit 14dc9355bd

View File

@@ -9,13 +9,14 @@
static void *js_defaultalloc(void *actx, void *ptr, int size)
{
#if defined(__has_feature)
#if __has_feature(address_sanitizer)
#ifndef __has_feature
#define __has_feature(x) 0
#endif
#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
if (size == 0) {
free(ptr);
return NULL;
}
#endif
#endif
return realloc(ptr, (size_t)size);
}