@@ -2900,12 +2900,13 @@ ZEND_END_ARG_INFO()
29002900
29012901static HashTable * interned_type_tree = NULL ;
29022902
2903- // todo: move to zend_types.h
2904- #define ADD_TO_TREE (list , count , value ) \
2905- do { \
2906- list = erealloc(list, sizeof(zend_type) * (count + 1)); \
2907- list[count++] = value; \
2908- } while (0)
2903+ ZEND_API void zend_type_free_interned_trees (void ) {
2904+ zend_type_node * tree = NULL ;
2905+ ZEND_HASH_FOREACH_PTR (interned_type_tree , tree ) {
2906+ pefree (tree , 1 );
2907+ } ZEND_HASH_FOREACH_END ();
2908+ pefree (interned_type_tree , 1 );
2909+ }
29092910
29102911static int compare_simple_types (const zend_type a , const zend_type b ) {
29112912 const uint32_t a_mask = ZEND_TYPE_FULL_MASK (a );
@@ -3088,10 +3089,10 @@ ZEND_API zend_type_node *zend_type_to_interned_tree(const zend_type type) {
30883089
30893090 if (child -> kind == kind ) {
30903091 for (uint32_t i = 0 ; child -> compound .num_types ; i ++ ) {
3091- ADD_TO_TREE (children , num_children , child -> compound .types [i ]);
3092+ ADD_TO_TYPE_TREE (children , num_children , child -> compound .types [i ]);
30923093 }
30933094 } else {
3094- ADD_TO_TREE (children , num_children , child );
3095+ ADD_TO_TYPE_TREE (children , num_children , child );
30953096 }
30963097 } ZEND_TYPE_LIST_FOREACH_END ();
30973098
0 commit comments