diff --git a/base/modules/desc/psb_desc_mod.F90 b/base/modules/desc/psb_desc_mod.F90 index c0916cf5..cfec78b3 100644 --- a/base/modules/desc/psb_desc_mod.F90 +++ b/base/modules/desc/psb_desc_mod.F90 @@ -1038,14 +1038,8 @@ contains & call psb_safe_ab_cpy(desc%lprm,desc_out%lprm,info) if (info == psb_success_)& & call psb_safe_ab_cpy(desc%idx_space,desc_out%idx_space,info) -!!$ if ((info == psb_success_).and.(allocated(desc%indxmap))) & -!!$ & call desc%indxmap%clone(desc_out%indxmap,info) -!!$ associate(indxin => desc%indxmap) -!!$ if ((info == psb_success_).and.(allocated(desc%indxmap))) & -!!$ & call indxin%clone(desc_out%indxmap,info) -!!$ end associate if ((info == psb_success_).and.(allocated(desc%indxmap))) & - & allocate(desc_out%indxmap,source=desc%indxmap,stat=info) + & call desc%indxmap%clone(desc_out%indxmap,info) if (info == psb_success_) & & call desc%v_halo_index%clone(desc_out%v_halo_index,info) if (info == psb_success_) & @@ -1054,8 +1048,6 @@ contains & call desc%v_ovrlap_index%clone(desc_out%v_ovrlap_index,info) if (info == psb_success_) & & call desc%v_ovr_mst_idx%clone(desc_out%v_ovr_mst_idx,info) - - else call desc_out%free(info) end if diff --git a/base/modules/desc/psb_gen_block_map_mod.f90 b/base/modules/desc/psb_gen_block_map_mod.f90 index 2cb31687..0a40d4b1 100644 --- a/base/modules/desc/psb_gen_block_map_mod.f90 +++ b/base/modules/desc/psb_gen_block_map_mod.f90 @@ -1143,8 +1143,12 @@ contains info = psb_success_ call psb_get_erraction(err_act) - if (allocated(outmap)) then - write(0,*) 'Error: should not be allocated on input' + if (allocated(outmap)) then + call outmap%free() + deallocate(outmap,stat=info) + end if + if (info /= 0) then + write(0,*) 'Error: could not cleanup output' info = -87 goto 9999 end if diff --git a/base/modules/desc/psb_glist_map_mod.f90 b/base/modules/desc/psb_glist_map_mod.f90 index 4097ae3c..1e96fb17 100644 --- a/base/modules/desc/psb_glist_map_mod.f90 +++ b/base/modules/desc/psb_glist_map_mod.f90 @@ -202,8 +202,12 @@ contains info = psb_success_ call psb_get_erraction(err_act) - if (allocated(outmap)) then - write(0,*) 'Error: should not be allocated on input' + if (allocated(outmap)) then + call outmap%free() + deallocate(outmap,stat=info) + end if + if (info /= 0) then + write(0,*) 'Error: could not cleanup output' info = -87 goto 9999 end if diff --git a/base/modules/desc/psb_hash_map_mod.f90 b/base/modules/desc/psb_hash_map_mod.f90 index 538441ed..0aa0a975 100644 --- a/base/modules/desc/psb_hash_map_mod.f90 +++ b/base/modules/desc/psb_hash_map_mod.f90 @@ -1381,8 +1381,12 @@ contains info = psb_success_ call psb_get_erraction(err_act) - if (allocated(outmap)) then - write(0,*) 'Error: should not be allocated on input' + if (allocated(outmap)) then + call outmap%free() + deallocate(outmap,stat=info) + end if + if (info /= 0) then + write(0,*) 'Error: could not cleanup output' info = -87 goto 9999 end if diff --git a/base/modules/desc/psb_list_map_mod.f90 b/base/modules/desc/psb_list_map_mod.f90 index a11e39ab..e2b6b5fc 100644 --- a/base/modules/desc/psb_list_map_mod.f90 +++ b/base/modules/desc/psb_list_map_mod.f90 @@ -662,8 +662,12 @@ contains info = psb_success_ call psb_get_erraction(err_act) - if (allocated(outmap)) then - write(0,*) 'Error: should not be allocated on input' + if (allocated(outmap)) then + call outmap%free() + deallocate(outmap,stat=info) + end if + if (info /= 0) then + write(0,*) 'Error: could not cleanup output' info = -87 goto 9999 end if diff --git a/base/modules/desc/psb_repl_map_mod.f90 b/base/modules/desc/psb_repl_map_mod.f90 index 6a6225bd..016d2acc 100644 --- a/base/modules/desc/psb_repl_map_mod.f90 +++ b/base/modules/desc/psb_repl_map_mod.f90 @@ -769,8 +769,12 @@ contains info = psb_success_ call psb_get_erraction(err_act) - if (allocated(outmap)) then - write(0,*) 'Error: should not be allocated on input' + if (allocated(outmap)) then + call outmap%free() + deallocate(outmap,stat=info) + end if + if (info /= 0) then + write(0,*) 'Error: could not cleanup output' info = -87 goto 9999 end if