summaryrefslogtreecommitdiff
path: root/ext/pcre/php_pcre.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2016-08-29 15:29:52 +0200
committerAnatol Belski <ab@php.net>2016-08-29 15:29:52 +0200
commita74757849776be99e86949e4862abf56bfa2115e (patch)
tree119fd1270c9d5621237f2d41b8af3d5952eb2726 /ext/pcre/php_pcre.c
parent0e709fe42d781209e955cf54d34e12361a784680 (diff)
parent1d7ec685c1dedffb3ed7b3865bf9c07fcc7598e7 (diff)
downloadphp-git-a74757849776be99e86949e4862abf56bfa2115e.tar.gz
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: fix possible memory leak
Diffstat (limited to 'ext/pcre/php_pcre.c')
-rw-r--r--ext/pcre/php_pcre.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 4ba5b29772..e10da07ea8 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -1176,6 +1176,11 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *su
if (UNEXPECTED(pce->name_count > 0)) {
subpat_names = make_subpats_table(num_subpats, pce);
if (!subpat_names) {
+ if (size_offsets <= 32) {
+ free_alloca(offsets, use_heap);
+ } else {
+ efree(offsets);
+ }
return NULL;
}
}