[Pcre-svn] [400] code/trunk: Fix memory leak for -8 error du…

Página Inicial
Delete this message
Autor: Subversion repository
Data:  
Para: pcre-svn
Assunto: [Pcre-svn] [400] code/trunk: Fix memory leak for -8 error during recursion.
Revision: 400
          http://vcs.pcre.org/viewvc?view=rev&revision=400
Author:   ph10
Date:     2009-03-21 16:59:40 +0000 (Sat, 21 Mar 2009)


Log Message:
-----------
Fix memory leak for -8 error during recursion.

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


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2009-03-21 12:34:15 UTC (rev 399)
+++ code/trunk/ChangeLog    2009-03-21 16:59:40 UTC (rev 400)
@@ -79,6 +79,13 @@


 20. If a pattern that was compiled with callouts was matched using pcre_dfa_
     exec(), but without supplying a callout function, matching went wrong. 
+    
+21. If PCRE_ERROR_MATCHLIMIT occurred during a recursion, there was a memory 
+    leak if the size of the offset vector was greater than 30. When the vector 
+    is smaller, the saved offsets during recursion go onto a local stack 
+    vector, but for larger vectors malloc() is used. It was failing to free 
+    when the recursion yielded PCRE_ERROR_MATCH_LIMIT (or any other "abnormal" 
+    error, in fact).



Version 7.8 05-Sep-08

Modified: code/trunk/pcre_exec.c
===================================================================
--- code/trunk/pcre_exec.c    2009-03-21 12:34:15 UTC (rev 399)
+++ code/trunk/pcre_exec.c    2009-03-21 16:59:40 UTC (rev 400)
@@ -1109,6 +1109,8 @@
         else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN)
           {
           DPRINTF(("Recursion gave error %d\n", rrc));
+          if (new_recursive.offset_save != stacksave)
+            (pcre_free)(new_recursive.offset_save);
           RRETURN(rrc);
           }