summaryrefslogtreecommitdiff
path: root/jsstate.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2021-04-17 21:42:49 +0200
committerTor Andersson <tor.andersson@artifex.com>2021-04-17 21:42:49 +0200
commite00c9ba79ca5f6508e3270d529d144fd566ce158 (patch)
treec467a6ba74641bcae3196b778865809506514da8 /jsstate.c
parent6d1404397f3c3433334418f56048bead007729ac (diff)
Don't call realloc with size=0 to free data.
Newer versions of the C spec and POSIX have changed the behavior of realloc called with size 0 to be implementation defined.
Diffstat (limited to 'jsstate.c')
-rw-r--r--jsstate.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/jsstate.c b/jsstate.c
index c90e135..0f026d5 100644
--- a/jsstate.c
+++ b/jsstate.c
@@ -10,15 +10,10 @@
static void *js_defaultalloc(void *actx, void *ptr, int size)
{
-#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
return realloc(ptr, (size_t)size);
}