From f4b67d768dc8164178057a253914110ba98f556f Mon Sep 17 00:00:00 2001 From: Xuefer Date: Sat, 7 Oct 2006 01:55:45 +0000 Subject: [PATCH] processor: reset refcount to 0 to kill leak warning git-svn-id: svn://svn.lighttpd.net/xcache/trunk@217 c26eb9a1-5813-0410-bd6c-c2e55f420ca7 --- processor/head.m4 | 12 ++++++++++++ processor/processor.m4 | 2 ++ 2 files changed, 14 insertions(+) diff --git a/processor/head.m4 b/processor/head.m4 index 4b1345a..4190e43 100644 --- a/processor/head.m4 +++ b/processor/head.m4 @@ -277,6 +277,18 @@ static void xc_fix_static_members(xc_processor_t *processor, zend_class_entry *d } /* }}} */ #endif +int xc_hash_reset_zval_refcount_applyer(void *pDest TSRMLS_DC) /* {{{ */ +{ + zval **zv = (zval **) pDest; + ZVAL_REFCOUNT(*zv) = 1; + return ZEND_HASH_APPLY_KEEP; +} +/* }}} */ +static void xc_hash_reset_zval_refcount(HashTable *hash TSRMLS_DC) /* {{{ */ +{ + zend_hash_apply(hash, xc_hash_reset_zval_refcount_applyer TSRMLS_CC); +} +/* }}} */ /* {{{ call op_array ctor handler */ extern zend_bool xc_have_op_array_ctor; static void xc_zend_extension_op_array_ctor_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) diff --git a/processor/processor.m4 b/processor/processor.m4 index 3526037..53d0011 100644 --- a/processor/processor.m4 +++ b/processor/processor.m4 @@ -294,6 +294,7 @@ DEF_STRUCT_P_FUNC(`zend_class_entry', , `dnl {{{ #endif STRUCT(HashTable, default_properties, HashTable_zval_ptr) + IFSTORE(`xc_hash_reset_zval_refcount(&dst->default_properties TSRMLS_CC);') IFCOPY(`dst->builtin_functions = src->builtin_functions;') DONE(builtin_functions) #ifdef ZEND_ENGINE_2 @@ -307,6 +308,7 @@ DEF_STRUCT_P_FUNC(`zend_class_entry', , `dnl {{{ STRUCT_P(HashTable, static_members, IFCALCSTORE(HashTable_zval_ptr_static_member_check, HashTable_zval_ptr)) # endif STRUCT(HashTable, constants_table, HashTable_zval_ptr) + IFSTORE(`xc_hash_reset_zval_refcount(&dst->constants_table TSRMLS_CC);') dnl runtime binding: ADD_INTERFACE will deal with it IFRESTORE(`