pcre2/backport-jit-fix-pcre2_jit_free_unused_memory-if-sljit-not-us.patch
2023-03-16 15:22:42 +08:00

40 lines
1.3 KiB
Diff

From 7846880d63cf4b0d0d861659e222cce9c597c914 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= <carenas@gmail.com>
Date: Thu, 1 Dec 2022 01:40:01 -0800
Subject: [PATCH] jit: fix pcre2_jit_free_unused_memory() if sljit not using
allocator (#165)
sljit allows building without an internal allocator, but instead using
an external one.
make sure to only invoke the corresponding sljit call if an internal
allocator is in use (the default and as coded in pcre integration) to
avoid problems if the code is changed to use an external allocator
instead.
Conflict:NA
Reference:https://github.com/PCRE2Project/pcre2/commit/7846880d63cf4b0d0d861659e222cce9c597c914
---
src/pcre2_jit_misc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/pcre2_jit_misc.c b/src/pcre2_jit_misc.c
index e57afad..bb6a558 100644
--- a/src/pcre2_jit_misc.c
+++ b/src/pcre2_jit_misc.c
@@ -110,8 +110,10 @@ pcre2_jit_free_unused_memory(pcre2_general_context *gcontext)
(void)gcontext; /* Suppress warning */
#else /* SUPPORT_JIT */
SLJIT_UNUSED_ARG(gcontext);
+#if (defined SLJIT_EXECUTABLE_ALLOCATOR && SLJIT_EXECUTABLE_ALLOCATOR)
sljit_free_unused_memory_exec();
-#endif /* SUPPORT_JIT */
+#endif /* SLJIT_EXECUTABLE_ALLOCATOR */
+#endif /* SUPPORT_JIT */
}
--
1.8.3.1