- if ((*type)->has_subtype == 1){
- ((s_smpi_subtype_t *)(*type)->substruct)->subtype_free(type);
- xbt_free((*type)->substruct);
+ if((*type)->attributes !=nullptr){
+ xbt_dict_cursor_t cursor = nullptr;
+ int* key;
+ void * value;
+ int flag;
+ xbt_dict_foreach((*type)->attributes, cursor, key, value){
+ smpi_type_key_elem elem =
+ static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, reinterpret_cast<const char*>(key), sizeof(int)));
+ if(elem!=nullptr && elem->delete_fn!=nullptr)
+ elem->delete_fn(*type,*key, value, &flag);
+ }
+ xbt_dict_free(&(*type)->attributes);