mirror of
https://github.com/ccxvii/mujs.git
synced 2026-02-05 17:29:43 +08:00
Issue 102: Fix ASAN build when using GCC.
GCC's address sanitizer sets the __SANITIZE_ADDRESS__ macro instead.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user