From: Dmitry Stogov Date: Tue, 31 Oct 2017 23:38:26 +0000 (+0300) Subject: Use Zend MM heap X-Git-Tag: php-7.3.0alpha1~1119 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ed5b4d5c99a311e8c026b1aa7faf5f7b308f0b84;p=php Use Zend MM heap --- diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index a2389df880..6b742560c5 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -65,7 +65,6 @@ static int _php_mb_regex_globals_ctor(zend_mb_regex_globals *pglobals) { pglobals->default_mbctype = ONIG_ENCODING_UTF8; pglobals->current_mbctype = ONIG_ENCODING_UTF8; - zend_hash_init(&(pglobals->ht_rc), 0, NULL, php_mb_regex_free_cache, 1); ZVAL_UNDEF(&pglobals->search_str); pglobals->search_re = (php_mb_regex_t*)NULL; pglobals->search_pos = 0; @@ -79,7 +78,6 @@ static int _php_mb_regex_globals_ctor(zend_mb_regex_globals *pglobals) /* {{{ _php_mb_regex_globals_dtor */ static void _php_mb_regex_globals_dtor(zend_mb_regex_globals *pglobals) { - zend_hash_destroy(&pglobals->ht_rc); } /* }}} */ @@ -126,7 +124,9 @@ PHP_MSHUTDOWN_FUNCTION(mb_regex) /* {{{ PHP_RINIT_FUNCTION(mb_regex) */ PHP_RINIT_FUNCTION(mb_regex) { - return MBSTRG(mb_regex_globals) ? SUCCESS: FAILURE; + if (!MBSTRG(mb_regex_globals)) return FAILURE; + zend_hash_init(&MBREX(ht_rc), 0, NULL, php_mb_regex_free_cache, 0); + return SUCCESS; } /* }}} */ @@ -145,7 +145,7 @@ PHP_RSHUTDOWN_FUNCTION(mb_regex) onig_region_free(MBREX(search_regs), 1); MBREX(search_regs) = (OnigRegion *)NULL; } - zend_hash_clean(&MBREX(ht_rc)); + zend_hash_destroy(&MBREX(ht_rc)); return SUCCESS; }