@@ -118,9 +118,6 @@ ZEND_API void zend_type_release(zend_type type, bool persistent) {
118
118
zend_string_release (ZEND_TYPE_NAME (* sublist_type ));
119
119
}
120
120
} ZEND_TYPE_LIST_FOREACH_END ();
121
- if (!ZEND_TYPE_USES_ARENA (* list_type ) && persistent ) {
122
- free (ZEND_TYPE_LIST (* list_type ));
123
- }
124
121
} else if (ZEND_TYPE_HAS_NAME (* list_type )) {
125
122
zend_string_release (ZEND_TYPE_NAME (* list_type ));
126
123
}
@@ -133,6 +130,28 @@ ZEND_API void zend_type_release(zend_type type, bool persistent) {
133
130
}
134
131
}
135
132
133
+ ZEND_API void zend_type_release_internal (zend_type type ) {
134
+ ZEND_ASSERT (!ZEND_TYPE_USES_ARENA (type ));
135
+ if (ZEND_TYPE_HAS_LIST (type )) {
136
+ zend_type * list_type , * sublist_type ;
137
+ ZEND_TYPE_LIST_FOREACH (ZEND_TYPE_LIST (type ), list_type ) {
138
+ if (ZEND_TYPE_HAS_LIST (* list_type )) {
139
+ ZEND_TYPE_LIST_FOREACH (ZEND_TYPE_LIST (* list_type ), sublist_type ) {
140
+ if (ZEND_TYPE_HAS_NAME (* sublist_type )) {
141
+ zend_string_release (ZEND_TYPE_NAME (* sublist_type ));
142
+ }
143
+ } ZEND_TYPE_LIST_FOREACH_END ();
144
+ free (ZEND_TYPE_LIST (* list_type ));
145
+ } else if (ZEND_TYPE_HAS_NAME (* list_type )) {
146
+ zend_string_release (ZEND_TYPE_NAME (* list_type ));
147
+ }
148
+ } ZEND_TYPE_LIST_FOREACH_END ();
149
+ free (ZEND_TYPE_LIST (type ));
150
+ } else if (ZEND_TYPE_HAS_NAME (type )) {
151
+ zend_string_release (ZEND_TYPE_NAME (type ));
152
+ }
153
+ }
154
+
136
155
void zend_free_internal_arg_info (zend_internal_function * function ) {
137
156
if ((function -> fn_flags & (ZEND_ACC_HAS_RETURN_TYPE |ZEND_ACC_HAS_TYPE_HINTS )) &&
138
157
function -> arg_info ) {
@@ -145,7 +164,7 @@ void zend_free_internal_arg_info(zend_internal_function *function) {
145
164
num_args ++ ;
146
165
}
147
166
for (i = 0 ; i < num_args ; i ++ ) {
148
- zend_type_release (arg_info [i ].type , /* persistent */ 1 );
167
+ zend_type_release_internal (arg_info [i ].type );
149
168
}
150
169
free (arg_info );
151
170
}
@@ -457,7 +476,7 @@ ZEND_API void destroy_zend_class(zval *zv)
457
476
ZEND_HASH_MAP_FOREACH_PTR (& ce -> properties_info , prop_info ) {
458
477
if (prop_info -> ce == ce ) {
459
478
zend_string_release (prop_info -> name );
460
- zend_type_release (prop_info -> type , /* persistent */ 1 );
479
+ zend_type_release_internal (prop_info -> type );
461
480
free (prop_info );
462
481
}
463
482
} ZEND_HASH_FOREACH_END ();
@@ -492,6 +511,7 @@ ZEND_API void destroy_zend_class(zval *zv)
492
511
} else {
493
512
zval_internal_ptr_dtor (& c -> value );
494
513
}
514
+ zend_type_release_internal (c -> type );
495
515
if (c -> doc_comment ) {
496
516
zend_string_release_ex (c -> doc_comment , 1 );
497
517
}
0 commit comments