com php-src: fix possible memory leak: ext/pcre/php_pcre.c
| From: | Anatol Belski | Date: | Mon, 29 Aug 2016 13:28:09 +0000 |
| Subject: | com php-src: fix possible memory leak: ext/pcre/php_pcre.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-94101@lists.php.net to get a copy of this message | ||
Commit: 1d7ec685c1dedffb3ed7b3865bf9c07fcc7598e7
Author: Anatol Belski <ab@php.net> Mon, 29 Aug 2016 15:28:09 +0200
Parents: eac7f4b6708ba1ff5bb2e76cc6d275419d50e589
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1d7ec685c1dedffb3ed7b3865bf9c07fcc7598e7
Log:
fix possible memory leak
Changed paths:
M ext/pcre/php_pcre.c
Diff:
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index fe6b7b3..1ff8ae4 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;
}
}