1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00

Fix memory leak

This commit is contained in:
Dmitry Stogov
2022-10-31 12:20:28 +03:00
parent 22f25532ed
commit 482ae71fda
2 changed files with 17 additions and 2 deletions

View File

@@ -0,0 +1,9 @@
--TEST--
Union and intersection type leaks
--FILE--
<?php
eval('abstract class y {function y(): (y&yy)|t {}}');
?>
DONE
--EXPECTF--
DONE

View File

@@ -110,9 +110,15 @@ ZEND_API void destroy_zend_function(zend_function *function)
ZEND_API void zend_type_release(zend_type type, bool persistent) {
if (ZEND_TYPE_HAS_LIST(type)) {
zend_type *list_type;
zend_type *list_type, *sublist_type;
ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(type), list_type) {
if (ZEND_TYPE_HAS_NAME(*list_type)) {
if (ZEND_TYPE_HAS_LIST(*list_type)) {
ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(*list_type), sublist_type) {
if (ZEND_TYPE_HAS_NAME(*sublist_type)) {
zend_string_release(ZEND_TYPE_NAME(*sublist_type));
}
} ZEND_TYPE_LIST_FOREACH_END();
} else if (ZEND_TYPE_HAS_NAME(*list_type)) {
zend_string_release(ZEND_TYPE_NAME(*list_type));
}
} ZEND_TYPE_LIST_FOREACH_END();