emalloced interned strings have to be deallocated before memory manager shutdown

This commit is contained in:
Dmitry Stogov 2014-02-17 22:30:35 +04:00
parent fc5e9bee29
commit 4d6ff31cb3
2 changed files with 6 additions and 2 deletions

View File

@ -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;

View File

@ -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 {