From: Dmitry Stogov Date: Mon, 17 Feb 2014 18:30:35 +0000 (+0400) Subject: emalloced interned strings have to be deallocated before memory manager shutdown X-Git-Tag: POST_PHPNG_MERGE~412^2~634 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4d6ff31cb31c661e3098d9dc07b156264dd39615;p=php emalloced interned strings have to be deallocated before memory manager shutdown --- diff --git a/Zend/zend_string.c b/Zend/zend_string.c index 0fda838983..170cb2c200 100644 --- a/Zend/zend_string.c +++ b/Zend/zend_string.c @@ -189,10 +189,14 @@ static void zend_interned_strings_restore_int(TSRMLS_D) while (idx > 0) { idx--; p = CG(interned_strings).arData + idx; - if (!(p->key->gc.u.v.flags & IS_STR_PERMANENT)) break; + if (p->key->gc.u.v.flags & IS_STR_PERMANENT) break; CG(interned_strings).nNumUsed--; CG(interned_strings).nNumOfElements--; + p->key->gc.u.v.flags &= ~IS_STR_INTERNED; + p->key->gc.refcount = 1; + STR_FREE(p->key); + nIndex = p->h & CG(interned_strings).nTableMask; if (CG(interned_strings).arHash[nIndex] == idx) { CG(interned_strings).arHash[nIndex] = p->val.u.next; diff --git a/main/main.c b/main/main.c index 2d12c2060b..b3dbfa0f8b 100644 --- a/main/main.c +++ b/main/main.c @@ -1827,10 +1827,10 @@ void php_request_shutdown(void *dummy) } zend_end_try(); /* 14. Free Willy (here be crashes) */ + zend_interned_strings_restore(TSRMLS_C); zend_try { shutdown_memory_manager(CG(unclean_shutdown) || !report_memleaks, 0 TSRMLS_CC); } zend_end_try(); - zend_interned_strings_restore(TSRMLS_C); /* 15. Reset max_execution_time */ zend_try {