Skip to content

Commit 89a7b7c

Browse files
committed
Fix leak in resolve_property_types
We need to free the original string as well, not just the lowercased one.
1 parent f4ded49 commit 89a7b7c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Zend/zend.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,11 +959,13 @@ static void zend_resolve_property_types(void) /* {{{ */
959959
if (UNEXPECTED(ce->type == ZEND_INTERNAL_CLASS && ZEND_CLASS_HAS_TYPE_HINTS(ce))) {
960960
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) {
961961
if (ZEND_TYPE_IS_NAME(prop_info->type)) {
962-
zend_string *type_name = zend_string_tolower(ZEND_TYPE_NAME(prop_info->type));
963-
zend_class_entry *prop_ce = zend_hash_find_ptr(CG(class_table), type_name);
962+
zend_string *type_name = ZEND_TYPE_NAME(prop_info->type);
963+
zend_string *lc_type_name = zend_string_tolower(type_name);
964+
zend_class_entry *prop_ce = zend_hash_find_ptr(CG(class_table), lc_type_name);
964965

965966
ZEND_ASSERT(prop_ce && prop_ce->type == ZEND_INTERNAL_CLASS);
966967
prop_info->type = ZEND_TYPE_ENCODE_CE(prop_ce, ZEND_TYPE_ALLOW_NULL(prop_info->type));
968+
zend_string_release(lc_type_name);
967969
zend_string_release(type_name);
968970
}
969971
} ZEND_HASH_FOREACH_END();

0 commit comments

Comments
 (0)