diff --git a/mlprec/impl/level/mld_c_base_onelev_free.f90 b/mlprec/impl/level/mld_c_base_onelev_free.f90 index e480e012..943522c7 100644 --- a/mlprec/impl/level/mld_c_base_onelev_free.f90 +++ b/mlprec/impl/level/mld_c_base_onelev_free.f90 @@ -54,6 +54,9 @@ subroutine mld_c_base_onelev_free(lv,info) if (allocated(lv%sm)) & & call lv%sm%free(info) + if (allocated(lv%wrk)) & + & call lv%wrk%free(info) + call lv%ac%free() if (lv%desc_ac%is_ok()) & & call lv%desc_ac%free(info) diff --git a/mlprec/impl/level/mld_d_base_onelev_free.f90 b/mlprec/impl/level/mld_d_base_onelev_free.f90 index 24947988..1dc24733 100644 --- a/mlprec/impl/level/mld_d_base_onelev_free.f90 +++ b/mlprec/impl/level/mld_d_base_onelev_free.f90 @@ -54,6 +54,9 @@ subroutine mld_d_base_onelev_free(lv,info) if (allocated(lv%sm)) & & call lv%sm%free(info) + if (allocated(lv%wrk)) & + & call lv%wrk%free(info) + call lv%ac%free() if (lv%desc_ac%is_ok()) & & call lv%desc_ac%free(info) diff --git a/mlprec/impl/level/mld_s_base_onelev_free.f90 b/mlprec/impl/level/mld_s_base_onelev_free.f90 index 89588074..bcb44113 100644 --- a/mlprec/impl/level/mld_s_base_onelev_free.f90 +++ b/mlprec/impl/level/mld_s_base_onelev_free.f90 @@ -54,6 +54,9 @@ subroutine mld_s_base_onelev_free(lv,info) if (allocated(lv%sm)) & & call lv%sm%free(info) + if (allocated(lv%wrk)) & + & call lv%wrk%free(info) + call lv%ac%free() if (lv%desc_ac%is_ok()) & & call lv%desc_ac%free(info) diff --git a/mlprec/impl/level/mld_z_base_onelev_free.f90 b/mlprec/impl/level/mld_z_base_onelev_free.f90 index 4e09b7f0..51dcadf5 100644 --- a/mlprec/impl/level/mld_z_base_onelev_free.f90 +++ b/mlprec/impl/level/mld_z_base_onelev_free.f90 @@ -54,6 +54,9 @@ subroutine mld_z_base_onelev_free(lv,info) if (allocated(lv%sm)) & & call lv%sm%free(info) + if (allocated(lv%wrk)) & + & call lv%wrk%free(info) + call lv%ac%free() if (lv%desc_ac%is_ok()) & & call lv%desc_ac%free(info) diff --git a/mlprec/mld_c_prec_type.f90 b/mlprec/mld_c_prec_type.f90 index dc0e0b70..66a8d749 100644 --- a/mlprec/mld_c_prec_type.f90 +++ b/mlprec/mld_c_prec_type.f90 @@ -579,7 +579,6 @@ contains end if me=-1 - call prec%free_wrk(info) if (allocated(prec%precv)) then do i=1,size(prec%precv) call prec%precv(i)%free(info) @@ -910,11 +909,13 @@ contains info = psb_err_internal_error_; goto 9999 end if - nlev = size(prec%precv) - do level = 1, nlev - call prec%precv(level)%free_wrk(info) - end do - + if (allocated(prec%precv)) then + nlev = size(prec%precv) + do level = 1, nlev + call prec%precv(level)%free_wrk(info) + end do + end if + call psb_erractionrestore(err_act) return diff --git a/mlprec/mld_d_prec_type.f90 b/mlprec/mld_d_prec_type.f90 index 512dc709..236a9ae6 100644 --- a/mlprec/mld_d_prec_type.f90 +++ b/mlprec/mld_d_prec_type.f90 @@ -579,7 +579,6 @@ contains end if me=-1 - call prec%free_wrk(info) if (allocated(prec%precv)) then do i=1,size(prec%precv) call prec%precv(i)%free(info) @@ -910,11 +909,13 @@ contains info = psb_err_internal_error_; goto 9999 end if - nlev = size(prec%precv) - do level = 1, nlev - call prec%precv(level)%free_wrk(info) - end do - + if (allocated(prec%precv)) then + nlev = size(prec%precv) + do level = 1, nlev + call prec%precv(level)%free_wrk(info) + end do + end if + call psb_erractionrestore(err_act) return diff --git a/mlprec/mld_s_prec_type.f90 b/mlprec/mld_s_prec_type.f90 index 3c739005..76b107d5 100644 --- a/mlprec/mld_s_prec_type.f90 +++ b/mlprec/mld_s_prec_type.f90 @@ -579,7 +579,6 @@ contains end if me=-1 - call prec%free_wrk(info) if (allocated(prec%precv)) then do i=1,size(prec%precv) call prec%precv(i)%free(info) @@ -910,11 +909,13 @@ contains info = psb_err_internal_error_; goto 9999 end if - nlev = size(prec%precv) - do level = 1, nlev - call prec%precv(level)%free_wrk(info) - end do - + if (allocated(prec%precv)) then + nlev = size(prec%precv) + do level = 1, nlev + call prec%precv(level)%free_wrk(info) + end do + end if + call psb_erractionrestore(err_act) return diff --git a/mlprec/mld_z_prec_type.f90 b/mlprec/mld_z_prec_type.f90 index 0e167216..0db5531b 100644 --- a/mlprec/mld_z_prec_type.f90 +++ b/mlprec/mld_z_prec_type.f90 @@ -579,7 +579,6 @@ contains end if me=-1 - call prec%free_wrk(info) if (allocated(prec%precv)) then do i=1,size(prec%precv) call prec%precv(i)%free(info) @@ -910,11 +909,13 @@ contains info = psb_err_internal_error_; goto 9999 end if - nlev = size(prec%precv) - do level = 1, nlev - call prec%precv(level)%free_wrk(info) - end do - + if (allocated(prec%precv)) then + nlev = size(prec%precv) + do level = 1, nlev + call prec%precv(level)%free_wrk(info) + end do + end if + call psb_erractionrestore(err_act) return