From 73417f882ac907a182e1491ead2eecb7c5e559cc Mon Sep 17 00:00:00 2001 From: zherczeg Date: Fri, 24 Jan 2020 08:28:23 +0000 Subject: [PATCH] The JIT stack should be freed when the low-level stack allocation fails. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1207 6239d852-aaf2-0410-a92c-79f79f948069 Petr Písař: Ported to 10.34. --- src/pcre2_jit_misc.c | 5 +++++ 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 -- 2.21.1