Skip to content

Commit d91fc5f

Browse files
committed
Fix leaks in assignments to overloaded objects
1 parent 8a3d87f commit d91fc5f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Zend/zend_execute.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,17 @@ static inline void zend_assign_to_object(znode *result, zval **object_ptr, znode
394394
*value = *orig_value;
395395
value->is_ref = 0;
396396
value->refcount = 0;
397+
} else if (value_op->op_type == IS_CONST) {
398+
zval *orig_value = value;
399+
400+
ALLOC_ZVAL(value);
401+
*value = *orig_value;
402+
value->is_ref = 0;
403+
value->refcount = 0;
404+
zval_copy_ctor(value);
397405
}
406+
407+
value->refcount++;
398408
if (opcode == ZEND_ASSIGN_OBJ) {
399409
zval tmp;
400410

@@ -423,6 +433,7 @@ static inline void zend_assign_to_object(znode *result, zval **object_ptr, znode
423433
}
424434
Z_OBJ_HT_P(object)->write_dimension(object, property_name, value TSRMLS_CC);
425435
}
436+
zval_ptr_dtor(&value);
426437

427438
FREE_OP(Ts, op2, EG(free_op2));
428439
if (result) {

0 commit comments

Comments
 (0)