@@ -2217,6 +2217,7 @@ void zend_do_declare_property(znode *var_name, znode *value, zend_uint access_ty
2217
2217
zend_property_info property_info ;
2218
2218
zend_property_info * existing_property_info ;
2219
2219
HashTable * target_symbol_table ;
2220
+ zend_bool free_var_name = 0 ;
2220
2221
2221
2222
if (access_type & ZEND_ACC_ABSTRACT ) {
2222
2223
zend_error (E_COMPILE_ERROR , "Properties cannot be declared abstract" );
@@ -2252,6 +2253,7 @@ void zend_do_declare_property(znode *var_name, znode *value, zend_uint access_ty
2252
2253
int priv_name_length ;
2253
2254
2254
2255
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 );
2256
+ free_var_name = 1 ;
2255
2257
zend_hash_update (target_symbol_table , priv_name , priv_name_length + 1 , & property , sizeof (zval * ), NULL );
2256
2258
property_info .name = priv_name ;
2257
2259
property_info .name_length = priv_name_length ;
@@ -2262,6 +2264,7 @@ void zend_do_declare_property(znode *var_name, znode *value, zend_uint access_ty
2262
2264
int prot_name_length ;
2263
2265
2264
2266
mangle_property_name (& prot_name , & prot_name_length , "*" , 1 , var_name -> u .constant .value .str .val , var_name -> u .constant .value .str .len );
2267
+ free_var_name = 1 ;
2265
2268
zend_hash_update (target_symbol_table , prot_name , prot_name_length + 1 , & property , sizeof (zval * ), NULL );
2266
2269
property_info .name = prot_name ;
2267
2270
property_info .name_length = prot_name_length ;
@@ -2277,6 +2280,9 @@ void zend_do_declare_property(znode *var_name, znode *value, zend_uint access_ty
2277
2280
property_info .h = zend_get_hash_value (property_info .name , property_info .name_length + 1 );
2278
2281
2279
2282
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 );
2283
+ if (free_var_name ) {
2284
+ efree (var_name -> u .constant .value .str .val );
2285
+ }
2280
2286
}
2281
2287
2282
2288
0 commit comments