From ed5b4d5c99a311e8c026b1aa7faf5f7b308f0b84 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Wed, 1 Nov 2017 02:38:26 +0300 Subject: [PATCH] Use Zend MM heap --- ext/mbstring/php_mbregex.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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; } -- 2.40.0