[Pcre-svn] [1207] code/trunk: The JIT stack should be freed …

Kezdőlap
Üzenet törlése
Szerző: Subversion repository
Dátum:  
Címzett: pcre-svn
Tárgy: [Pcre-svn] [1207] code/trunk: The JIT stack should be freed when the low-level stack allocation fails.
Revision: 1207
          http://www.exim.org/viewvc/pcre2?view=rev&revision=1207
Author:   zherczeg
Date:     2020-01-24 08:28:23 +0000 (Fri, 24 Jan 2020)
Log Message:
-----------
The JIT stack should be freed when the low-level stack allocation fails.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/src/pcre2_jit_misc.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2020-01-22 17:50:12 UTC (rev 1206)
+++ code/trunk/ChangeLog    2020-01-24 08:28:23 UTC (rev 1207)
@@ -43,7 +43,9 @@


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
------------------------------


Modified: code/trunk/src/pcre2_jit_misc.c
===================================================================
--- code/trunk/src/pcre2_jit_misc.c    2020-01-22 17:50:12 UTC (rev 1206)
+++ code/trunk/src/pcre2_jit_misc.c    2020-01-24 08:28:23 UTC (rev 1207)
@@ -145,6 +145,11 @@
 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