summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2009-03-21 16:59:40 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2009-03-21 16:59:40 +0000
commitfcf8330c26b98224222f9fb53443f9f422e150b8 (patch)
tree5aa8c31a6893c7038c44f698c8198473ec1da08c
parent9582580e18ca51f492526e73c3fb8a485461f379 (diff)
downloadpcre-fcf8330c26b98224222f9fb53443f9f422e150b8.tar.gz
Fix memory leak for -8 error during recursion.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@400 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--ChangeLog7
-rw-r--r--pcre_exec.c2
2 files changed, 9 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 2ba0cbb..24b7084 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -79,6 +79,13 @@ Version 7.9 xx-xxx-09
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
diff --git a/pcre_exec.c b/pcre_exec.c
index 4681e92..aaed7e8 100644
--- a/pcre_exec.c
+++ b/pcre_exec.c
@@ -1109,6 +1109,8 @@ for (;;)
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);
}