The JIT stack should be freed when the low-level stack allocation fails.

This commit is contained in:
Zoltán Herczeg 2020-01-24 08:28:23 +00:00
parent e8d70e2459
commit 09984bb0e4
2 changed files with 7 additions and 0 deletions

View File

@ -43,6 +43,8 @@ the minimum.
11. Added PCRE2_SUBSTITUTE_REPLACEMENT_ONLY. 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 Version 10.34 21-November-2019
------------------------------ ------------------------------

View File

@ -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); jit_stack = PRIV(memctl_malloc)(sizeof(pcre2_real_jit_stack), (pcre2_memctl *)gcontext);
if (jit_stack == NULL) return NULL; if (jit_stack == NULL) return NULL;
jit_stack->stack = sljit_allocate_stack(startsize, maxsize, &jit_stack->memctl); 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; return jit_stack;
#endif #endif