[Pcre-svn] [1517] code/trunk: Fix memory leak for subroutine…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1517] code/trunk: Fix memory leak for subroutine call with more than 10 captured groups to be
Revision: 1517
          http://vcs.pcre.org/viewvc?view=rev&revision=1517
Author:   ph10
Date:     2015-02-06 12:10:13 +0000 (Fri, 06 Feb 2015)


Log Message:
-----------
Fix memory leak for subroutine call with more than 10 captured groups to be
saved.

Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcre_exec.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2015-02-03 18:07:34 UTC (rev 1516)
+++ code/trunk/ChangeLog    2015-02-06 12:10:13 UTC (rev 1517)
@@ -1,7 +1,7 @@
 ChangeLog for PCRE
 ------------------


-Version 8.37 xx-xxx-201x
+Version 8.37 xx-xxx-2015
------------------------

1. When an (*ACCEPT) is triggered inside capturing parentheses, it arranges
@@ -19,9 +19,12 @@

 4.  An attempt to do global matching in pcretest with a zero-length ovector
     caused a crash. 
+    
+5.  Fixed a memory leak during matching that could occur for a subpattern
+    subroutine call (recursive or otherwise) if the number of captured groups
+    that had to be saved was greater than ten.



-
Version 8.36 26-September-2014
------------------------------


Modified: code/trunk/pcre_exec.c
===================================================================
--- code/trunk/pcre_exec.c    2015-02-03 18:07:34 UTC (rev 1516)
+++ code/trunk/pcre_exec.c    2015-02-06 12:10:13 UTC (rev 1517)
@@ -1840,7 +1840,11 @@
         are defined in a range that can be tested for. */


         if (rrc >= MATCH_BACKTRACK_MIN && rrc <= MATCH_BACKTRACK_MAX)
+          { 
+          if (new_recursive.offset_save != stacksave)
+            (PUBL(free))(new_recursive.offset_save);
           RRETURN(MATCH_NOMATCH);
+          } 


         /* Any return code other than NOMATCH is an error. */