com php-src: emalloced interned strings have to be deallocated before memory manager shutdown: Zend/zend_string.c main/main.c
| From: | Dmitry Stogov | Date: | Mon, 17 Feb 2014 18:30:35 +0000 |
| Subject: | com php-src: emalloced interned strings have to be deallocated before memory manager shutdown: Zend/zend_string.c main/main.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-78051@lists.php.net to get a copy of this message | ||
Commit: 4d6ff31cb31c661e3098d9dc07b156264dd39615
Author: Dmitry Stogov <dmitry@zend.com> Mon, 17 Feb 2014 22:30:35 +0400
Parents: fc5e9bee29e95cf172e1416c6e725b7f444e5dc8
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4d6ff31cb31c661e3098d9dc07b156264dd39615
Log:
emalloced interned strings have to be deallocated before memory manager shutdown
Changed paths:
M Zend/zend_string.c
M main/main.c
Diff:
diff --git a/Zend/zend_string.c b/Zend/zend_string.c
index 0fda838..170cb2c 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 2d12c20..b3dbfa0 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 {