diff --git a/prec/impl/psb_c_bjacprec_impl.f90 b/prec/impl/psb_c_bjacprec_impl.f90 index 59b019331..c2f9d510d 100644 --- a/prec/impl/psb_c_bjacprec_impl.f90 +++ b/prec/impl/psb_c_bjacprec_impl.f90 @@ -644,6 +644,10 @@ subroutine psb_c_bjac_precbld(a,desc_a,prec,info,amold,vmold,imold) enddo deallocate(prec%av,stat=info) endif + if (allocated (prec%dv)) then + call prec%dv%free(info) + if (info == 0) deallocate(prec%dv) + end if end if if (.not.allocated(prec%av)) then allocate(prec%av(psb_max_avsz),stat=info) diff --git a/prec/impl/psb_c_diagprec_impl.f90 b/prec/impl/psb_c_diagprec_impl.f90 index 4e7c766a4..296fe8e21 100644 --- a/prec/impl/psb_c_diagprec_impl.f90 +++ b/prec/impl/psb_c_diagprec_impl.f90 @@ -270,7 +270,7 @@ subroutine psb_c_diag_precbld(a,desc_a,prec,info,amold,vmold,imold) prec%d(i) = cone end do - allocate(prec%dv,stat=info) + if (.not.allocated(prec%dv)) allocate(prec%dv,stat=info) if (info == 0) then if (present(vmold)) then allocate(prec%dv%v,mold=vmold,stat=info) diff --git a/prec/impl/psb_d_bjacprec_impl.f90 b/prec/impl/psb_d_bjacprec_impl.f90 index 9f5b75a79..e0eaa5be1 100644 --- a/prec/impl/psb_d_bjacprec_impl.f90 +++ b/prec/impl/psb_d_bjacprec_impl.f90 @@ -644,6 +644,10 @@ subroutine psb_d_bjac_precbld(a,desc_a,prec,info,amold,vmold,imold) enddo deallocate(prec%av,stat=info) endif + if (allocated (prec%dv)) then + call prec%dv%free(info) + if (info == 0) deallocate(prec%dv) + end if end if if (.not.allocated(prec%av)) then allocate(prec%av(psb_max_avsz),stat=info) diff --git a/prec/impl/psb_d_diagprec_impl.f90 b/prec/impl/psb_d_diagprec_impl.f90 index ec624908c..695f48876 100644 --- a/prec/impl/psb_d_diagprec_impl.f90 +++ b/prec/impl/psb_d_diagprec_impl.f90 @@ -270,7 +270,7 @@ subroutine psb_d_diag_precbld(a,desc_a,prec,info,amold,vmold,imold) prec%d(i) = done end do - allocate(prec%dv,stat=info) + if (.not.allocated(prec%dv)) allocate(prec%dv,stat=info) if (info == 0) then if (present(vmold)) then allocate(prec%dv%v,mold=vmold,stat=info) diff --git a/prec/impl/psb_s_bjacprec_impl.f90 b/prec/impl/psb_s_bjacprec_impl.f90 index a477c663d..405c9ad5f 100644 --- a/prec/impl/psb_s_bjacprec_impl.f90 +++ b/prec/impl/psb_s_bjacprec_impl.f90 @@ -644,6 +644,10 @@ subroutine psb_s_bjac_precbld(a,desc_a,prec,info,amold,vmold,imold) enddo deallocate(prec%av,stat=info) endif + if (allocated (prec%dv)) then + call prec%dv%free(info) + if (info == 0) deallocate(prec%dv) + end if end if if (.not.allocated(prec%av)) then allocate(prec%av(psb_max_avsz),stat=info) diff --git a/prec/impl/psb_s_diagprec_impl.f90 b/prec/impl/psb_s_diagprec_impl.f90 index 8e93f9647..7ad4785d9 100644 --- a/prec/impl/psb_s_diagprec_impl.f90 +++ b/prec/impl/psb_s_diagprec_impl.f90 @@ -270,7 +270,7 @@ subroutine psb_s_diag_precbld(a,desc_a,prec,info,amold,vmold,imold) prec%d(i) = sone end do - allocate(prec%dv,stat=info) + if (.not.allocated(prec%dv)) allocate(prec%dv,stat=info) if (info == 0) then if (present(vmold)) then allocate(prec%dv%v,mold=vmold,stat=info) diff --git a/prec/impl/psb_z_bjacprec_impl.f90 b/prec/impl/psb_z_bjacprec_impl.f90 index 91e833a45..375241a6e 100644 --- a/prec/impl/psb_z_bjacprec_impl.f90 +++ b/prec/impl/psb_z_bjacprec_impl.f90 @@ -644,6 +644,10 @@ subroutine psb_z_bjac_precbld(a,desc_a,prec,info,amold,vmold,imold) enddo deallocate(prec%av,stat=info) endif + if (allocated (prec%dv)) then + call prec%dv%free(info) + if (info == 0) deallocate(prec%dv) + end if end if if (.not.allocated(prec%av)) then allocate(prec%av(psb_max_avsz),stat=info) diff --git a/prec/impl/psb_z_diagprec_impl.f90 b/prec/impl/psb_z_diagprec_impl.f90 index 6940af2a0..4bc7ce612 100644 --- a/prec/impl/psb_z_diagprec_impl.f90 +++ b/prec/impl/psb_z_diagprec_impl.f90 @@ -270,7 +270,7 @@ subroutine psb_z_diag_precbld(a,desc_a,prec,info,amold,vmold,imold) prec%d(i) = zone end do - allocate(prec%dv,stat=info) + if (.not.allocated(prec%dv)) allocate(prec%dv,stat=info) if (info == 0) then if (present(vmold)) then allocate(prec%dv%v,mold=vmold,stat=info)