summaryrefslogtreecommitdiff
path: root/ext/pcre/php_pcre.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-02-28 13:37:55 +0400
committerDmitry Stogov <dmitry@zend.com>2014-02-28 13:37:55 +0400
commit045c5fddfa79048bd823ff85b5a35dc6f30b1598 (patch)
tree1dc9cd9bacc9d5242b868aeeaed4c3391e3727c1 /ext/pcre/php_pcre.c
parent9d1294e33dd374f4d798b65e530fd75febdadb2b (diff)
downloadphp-git-045c5fddfa79048bd823ff85b5a35dc6f30b1598.tar.gz
Fixed memory leaks
Diffstat (limited to 'ext/pcre/php_pcre.c')
-rw-r--r--ext/pcre/php_pcre.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index c27f3f7eb1..0a62f6f0b2 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -96,6 +96,7 @@ static void php_free_pcre_cache(zval *data) /* {{{ */
if ((void*)pce->tables) pefree((void*)pce->tables, 1);
pefree(pce->locale, 1);
#endif
+ pefree(pce, 1);
}
/* }}} */
@@ -1392,8 +1393,10 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
old_replace_count = replace_count;
if ((result = php_replace_in_subject(regex, replace, subject, &result_len, limit_val, is_callable_replace, &replace_count TSRMLS_CC)) != NULL) {
if (!is_filter || replace_count > old_replace_count) {
+//??? TODO: reimpplement to avoid double reallocation
//??? RETVAL_STRINGL(result, result_len, 0);
RETVAL_STRINGL(result, result_len);
+ efree(result);
} else {
efree(result);
}