diff --git a/mlprec/mld_c_slu_solver.F90 b/mlprec/mld_c_slu_solver.F90 index 8ac58e90..84cebbdc 100644 --- a/mlprec/mld_c_slu_solver.F90 +++ b/mlprec/mld_c_slu_solver.F90 @@ -332,12 +332,11 @@ contains call psb_erractionsave(err_act) - - info = mld_cslu_free(sv%lufactors) - - if (info /= psb_success_) goto 9999 + if (c_associated(sv%lufactors)) then + info = mld_cslu_free(sv%lufactors) + end if sv%lufactors = c_null_ptr - + if (info /= psb_success_) goto 9999 call psb_erractionrestore(err_act) return diff --git a/mlprec/mld_d_slu_solver.F90 b/mlprec/mld_d_slu_solver.F90 index f25272c0..ec1b4744 100644 --- a/mlprec/mld_d_slu_solver.F90 +++ b/mlprec/mld_d_slu_solver.F90 @@ -332,12 +332,11 @@ contains call psb_erractionsave(err_act) - - info = mld_dslu_free(sv%lufactors) - - if (info /= psb_success_) goto 9999 + if (c_associated(sv%lufactors)) then + info = mld_dslu_free(sv%lufactors) + end if sv%lufactors = c_null_ptr - + if (info /= psb_success_) goto 9999 call psb_erractionrestore(err_act) return diff --git a/mlprec/mld_d_sludist_solver.F90 b/mlprec/mld_d_sludist_solver.F90 index 82cbffad..46173b59 100644 --- a/mlprec/mld_d_sludist_solver.F90 +++ b/mlprec/mld_d_sludist_solver.F90 @@ -344,11 +344,12 @@ contains call psb_erractionsave(err_act) - info = mld_dsludist_free(sv%lufactors) + if (c_associated(sv%lufactors)) then + info = mld_dsludist_free(sv%lufactors) + end if + sv%lufactors = c_null_ptr if (info /= psb_success_) goto 9999 - sv%lufactors = c_null_ptr - call psb_erractionrestore(err_act) return diff --git a/mlprec/mld_s_slu_solver.F90 b/mlprec/mld_s_slu_solver.F90 index 3a0936e8..c8d3d4fc 100644 --- a/mlprec/mld_s_slu_solver.F90 +++ b/mlprec/mld_s_slu_solver.F90 @@ -332,12 +332,11 @@ contains call psb_erractionsave(err_act) - - info = mld_sslu_free(sv%lufactors) - - if (info /= psb_success_) goto 9999 + if (c_associated(sv%lufactors)) then + info = mld_sslu_free(sv%lufactors) + end if sv%lufactors = c_null_ptr - + if (info /= psb_success_) goto 9999 call psb_erractionrestore(err_act) return diff --git a/mlprec/mld_z_slu_solver.F90 b/mlprec/mld_z_slu_solver.F90 index 8d490276..7322f4f3 100644 --- a/mlprec/mld_z_slu_solver.F90 +++ b/mlprec/mld_z_slu_solver.F90 @@ -332,12 +332,11 @@ contains call psb_erractionsave(err_act) - - info = mld_zslu_free(sv%lufactors) - - if (info /= psb_success_) goto 9999 + if (c_associated(sv%lufactors)) then + info = mld_zslu_free(sv%lufactors) + end if sv%lufactors = c_null_ptr - + if (info /= psb_success_) goto 9999 call psb_erractionrestore(err_act) return diff --git a/mlprec/mld_z_sludist_solver.F90 b/mlprec/mld_z_sludist_solver.F90 index fe82d709..f8b8b645 100644 --- a/mlprec/mld_z_sludist_solver.F90 +++ b/mlprec/mld_z_sludist_solver.F90 @@ -344,11 +344,12 @@ contains call psb_erractionsave(err_act) - info = mld_zsludist_free(sv%lufactors) + if (c_associated(sv%lufactors)) then + info = mld_zsludist_free(sv%lufactors) + end if + sv%lufactors = c_null_ptr if (info /= psb_success_) goto 9999 - sv%lufactors = c_null_ptr - call psb_erractionrestore(err_act) return