From: Stanislav Malyshev Date: Sun, 27 Jul 2003 12:03:54 +0000 (+0000) Subject: fix leaks with class constants (bug #24699) X-Git-Tag: BEFORE_ARG_INFO~81 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5724c7a66c49ba7f42f3f2b91f3196977f016ac0;p=php fix leaks with class constants (bug #24699) --- diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 1c9f1f8314..8d1aa3d945 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2513,6 +2513,7 @@ void zend_do_fold_constant(znode *result, znode *constant_name TSRMLS_DC) if (zend_hash_find(&CG(active_class_entry)->constants_table, constant_name->u.constant.value.str.val, constant_name->u.constant.value.str.len+1, (void **) &zresult) != SUCCESS) { if (zend_get_constant(constant_name->u.constant.value.str.val, constant_name->u.constant.value.str.len, &result->u.constant TSRMLS_CC)) { + zval_dtor(&constant_name->u.constant); return; } else { zend_error(E_COMPILE_ERROR, "Cannot find %s constant in class %s\n", @@ -2522,6 +2523,7 @@ void zend_do_fold_constant(znode *result, znode *constant_name TSRMLS_DC) result->u.constant = **zresult; zval_copy_ctor(&result->u.constant); + zval_dtor(&constant_name->u.constant); } void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode TSRMLS_DC) diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index 365f3cf482..2db90d3530 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -288,6 +288,8 @@ ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC if (retval) { *result = c->value; zval_copy_ctor(result); + result->refcount = 1; + result->is_ref = 0; } return retval;