diff --git a/ChangeLog b/ChangeLog index 996a1a1..48d423b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -43,6 +43,8 @@ the minimum. 11. Added PCRE2_SUBSTITUTE_REPLACEMENT_ONLY. +12. The JIT stack should be freed when the low-level stack allocation fails. + Version 10.34 21-November-2019 ------------------------------ diff --git a/src/pcre2_jit_misc.c b/src/pcre2_jit_misc.c index efdb055..36abdba 100644 --- a/src/pcre2_jit_misc.c +++ b/src/pcre2_jit_misc.c @@ -145,6 +145,11 @@ maxsize = (maxsize + STACK_GROWTH_RATE - 1) & ~(STACK_GROWTH_RATE - 1); jit_stack = PRIV(memctl_malloc)(sizeof(pcre2_real_jit_stack), (pcre2_memctl *)gcontext); if (jit_stack == NULL) return NULL; jit_stack->stack = sljit_allocate_stack(startsize, maxsize, &jit_stack->memctl); +if (jit_stack->stack == NULL) + { + jit_stack->memctl.free(jit_stack, jit_stack->memctl.memory_data); + return NULL; + } return jit_stack; #endif