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