]> granicus.if.org Git - php/commitdiff
fix possible memory leak
authorAnatol Belski <ab@php.net>
Mon, 29 Aug 2016 13:28:09 +0000 (15:28 +0200)
committerAnatol Belski <ab@php.net>
Mon, 29 Aug 2016 13:28:09 +0000 (15:28 +0200)
ext/pcre/php_pcre.c

index fe6b7b39846bec5339cd8e1eeec979e832324c98..1ff8ae4654b81e08321aaaef15d8628d8dca9bbd 100644 (file)
@@ -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;
                }
        }