1
0
mirror of https://github.com/php/php-src.git synced 2026-04-13 02:52:48 +02:00

Merge branch 'PHP-7.3'

* PHP-7.3:
  Fix memory leak in pcre cache
This commit is contained in:
Anatol Belski
2018-09-09 10:39:15 +02:00

View File

@@ -549,6 +549,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
pcre_cache_entry new_entry;
int rc;
zend_string *key;
pcre_cache_entry *ret;
#if HAVE_SETLOCALE
if (BG(locale_string) &&
@@ -843,15 +844,19 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
zend_string *str = zend_string_init(ZSTR_VAL(key), ZSTR_LEN(key), 1);
GC_MAKE_PERSISTENT_LOCAL(str);
#if HAVE_SETLOCALE
if (key != regex) {
zend_string_release_ex(key, 0);
}
#endif
key = str;
ret = zend_hash_add_new_mem(&PCRE_G(pcre_cache), str, &new_entry, sizeof(pcre_cache_entry));
zend_string_release(str);
} else {
ret = zend_hash_add_new_mem(&PCRE_G(pcre_cache), key, &new_entry, sizeof(pcre_cache_entry));
}
return zend_hash_add_new_mem(&PCRE_G(pcre_cache), key, &new_entry, sizeof(pcre_cache_entry));
return ret;
}
/* }}} */