Skip to content

Commit 5c35594

Browse files
committed
Fix memory leak triggered by unsuccessful dynamic property unserialization
Closes GH-9468
1 parent 6f2f228 commit 5c35594

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ext/standard/var_unserializer.re

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,11 +644,13 @@ declared_property:
644644
if (UNEXPECTED(obj->ce->ce_flags & ZEND_ACC_NO_DYNAMIC_PROPERTIES)) {
645645
zend_throw_error(NULL, "Cannot create dynamic property %s::$%s",
646646
ZSTR_VAL(obj->ce->name), zend_get_unmangled_property_name(Z_STR_P(&key)));
647+
zval_ptr_dtor_str(&key);
647648
goto failure;
648649
} else if (!(obj->ce->ce_flags & ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES)) {
649650
zend_error(E_DEPRECATED, "Creation of dynamic property %s::$%s is deprecated",
650651
ZSTR_VAL(obj->ce->name), zend_get_unmangled_property_name(Z_STR_P(&key)));
651652
if (EG(exception)) {
653+
zval_ptr_dtor_str(&key);
652654
goto failure;
653655
}
654656
}

0 commit comments

Comments
 (0)