Call _pcre2_jit_free from pcre2_code_free.

This commit is contained in:
Philip.Hazel 2014-10-07 13:07:20 +00:00
parent 2148a4093e
commit cc463c76a3
3 changed files with 24 additions and 5 deletions

View File

@ -668,8 +668,6 @@ static const uint8_t opcode_possessify[] = {
};
/* FIXME: this is currently incomplete (free JIT?) */
/*************************************************
* Free compiled code *
*************************************************/
@ -677,7 +675,11 @@ static const uint8_t opcode_possessify[] = {
PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
pcre2_code_free(pcre2_code *code)
{
if (code != NULL) code->memctl.free(code, code->memctl.memory_data);
if (code != NULL)
{
if (code->executable_jit != NULL) PRIV(jit_free(code->executable_jit));
code->memctl.free(code, code->memctl.memory_data);
}
}

View File

@ -1858,6 +1858,7 @@ is available. */
#define _pcre2_compile_context_init PCRE2_SUFFIX(_pcre2_compile_context_init_)
#define _pcre2_find_bracket PCRE2_SUFFIX(_pcre2_find_bracket_)
#define _pcre2_is_newline PCRE2_SUFFIX(_pcre2_is_newline_)
#define _pcre2_jit_free PCRE2_SUFFIX(_pcre2_jit_free_)
#define _pcre2_jit_get_size PCRE2_SUFFIX(_pcre2_jit_get_size_)
#define _pcre2_match_context_init PCRE2_SUFFIX(_pcre2_match_context_init_)
#define _pcre2_memctl_malloc PCRE2_SUFFIX(_pcre2_memctl_malloc_)
@ -1877,6 +1878,7 @@ extern void _pcre2_compile_context_init(pcre2_compile_context *, BOOL);
extern PCRE2_SPTR _pcre2_find_bracket(PCRE2_SPTR, BOOL, int);
extern BOOL _pcre2_is_newline(PCRE2_SPTR, uint32_t, PCRE2_SPTR, uint32_t *,
BOOL);
extern void _pcre2_jit_free(void *);
extern size_t _pcre2_jit_get_size(void *);
extern void _pcre2_match_context_init(pcre2_match_context *, BOOL);
extern void *_pcre2_memctl_malloc(size_t, pcre2_memctl *);

View File

@ -44,14 +44,29 @@ POSSIBILITY OF SUCH DAMAGE.
#endif
/* FIXME: these are dummy functions */
/*************************************************
* Free JIT compiled code *
*************************************************/
void
PRIV(jit_free)(void *executable_jit)
{
#ifndef SUPPORT_JIT
(void)executable_jit;
#else /* SUPPORT_JIT */
/* Dummy code */
(void)executable_jit;
#endif /* SUPPORT_JIT */
}
/*************************************************
* Free unused JIT memory *
*************************************************/
PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
pcre2_jit_free_unused_memory(pcre2_general_context *gcontext)
{