diff --git a/amgprec/amg_c_jac_solver.f90 b/amgprec/amg_c_jac_solver.f90 index 55335f1b..90ed85ce 100644 --- a/amgprec/amg_c_jac_solver.f90 +++ b/amgprec/amg_c_jac_solver.f90 @@ -403,7 +403,10 @@ contains info = psb_success_ call sv%a%free() - call sv%dv%free(info) + if (allocated(sv%dv)) then + call sv%dv%free(info) + deallocate(sv%dv) + end if if (allocated(sv%d)) deallocate(sv%d) call psb_erractionrestore(err_act) diff --git a/amgprec/amg_d_jac_solver.f90 b/amgprec/amg_d_jac_solver.f90 index 25bb1375..eb7c93ce 100644 --- a/amgprec/amg_d_jac_solver.f90 +++ b/amgprec/amg_d_jac_solver.f90 @@ -403,7 +403,10 @@ contains info = psb_success_ call sv%a%free() - call sv%dv%free(info) + if (allocated(sv%dv)) then + call sv%dv%free(info) + deallocate(sv%dv) + end if if (allocated(sv%d)) deallocate(sv%d) call psb_erractionrestore(err_act) diff --git a/amgprec/amg_s_jac_solver.f90 b/amgprec/amg_s_jac_solver.f90 index 8cc66bbc..0ecbd10d 100644 --- a/amgprec/amg_s_jac_solver.f90 +++ b/amgprec/amg_s_jac_solver.f90 @@ -403,7 +403,10 @@ contains info = psb_success_ call sv%a%free() - call sv%dv%free(info) + if (allocated(sv%dv)) then + call sv%dv%free(info) + deallocate(sv%dv) + end if if (allocated(sv%d)) deallocate(sv%d) call psb_erractionrestore(err_act) diff --git a/amgprec/amg_z_jac_solver.f90 b/amgprec/amg_z_jac_solver.f90 index 28f1199e..5d273537 100644 --- a/amgprec/amg_z_jac_solver.f90 +++ b/amgprec/amg_z_jac_solver.f90 @@ -403,7 +403,10 @@ contains info = psb_success_ call sv%a%free() - call sv%dv%free(info) + if (allocated(sv%dv)) then + call sv%dv%free(info) + deallocate(sv%dv) + end if if (allocated(sv%d)) deallocate(sv%d) call psb_erractionrestore(err_act)