cvs: ZendEngine2 / zend_compile.c
| From: | Zeev Suraski | Date: | Sat, 01 Mar 2003 19:08:44 +0000 |
| Subject: | cvs: ZendEngine2 / zend_compile.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-981@lists.php.net to get a copy of this message | ||
zeev Sat Mar 1 14:08:44 2003 EDT
Modified files:
/ZendEngine2 zend_compile.c
Log:
Fix mem leak
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.376 ZendEngine2/zend_compile.c:1.377
--- ZendEngine2/zend_compile.c:1.376 Sat Mar 1 09:57:49 2003
+++ ZendEngine2/zend_compile.c Sat Mar 1 14:08:41 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.c,v 1.376 2003/03/01 14:57:49 andi Exp $ */
+/* $Id: zend_compile.c,v 1.377 2003/03/01 19:08:41 zeev Exp $ */
#include "zend_language_parser.h"
#include "zend.h"
@@ -2217,6 +2217,7 @@
zend_property_info property_info;
zend_property_info *existing_property_info;
HashTable *target_symbol_table;
+ zend_bool free_var_name = 0;
if (access_type & ZEND_ACC_ABSTRACT) {
zend_error(E_COMPILE_ERROR, "Properties cannot be declared abstract");
@@ -2252,6 +2253,7 @@
int priv_name_length;
mangle_property_name(&priv_name, &priv_name_length, CG(active_class_entry)->name,
CG(active_class_entry)->name_length, var_name->u.constant.value.str.val,
var_name->u.constant.value.str.len);
+ free_var_name = 1;
zend_hash_update(target_symbol_table, priv_name, priv_name_length+1, &property, sizeof(zval
*), NULL);
property_info.name = priv_name;
property_info.name_length = priv_name_length;
@@ -2262,6 +2264,7 @@
int prot_name_length;
mangle_property_name(&prot_name, &prot_name_length, "*", 1,
var_name->u.constant.value.str.val, var_name->u.constant.value.str.len);
+ free_var_name = 1;
zend_hash_update(target_symbol_table, prot_name, prot_name_length+1, &property, sizeof(zval
*), NULL);
property_info.name = prot_name;
property_info.name_length = prot_name_length;
@@ -2277,6 +2280,9 @@
property_info.h = zend_get_hash_value(property_info.name, property_info.name_length+1);
zend_hash_update(&CG(active_class_entry)->properties_info,
var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property_info,
sizeof(zend_property_info), NULL);
+ if (free_var_name) {
+ efree(var_name->u.constant.value.str.val);
+ }
}