diff --git a/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc b/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc index b7817352a5d9cc70c11b5f346a2df4cc36536d66..aa99d09e129121b0a105053074777b109887468b 100644 --- a/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc +++ b/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc @@ -492,7 +492,10 @@ namespace AMDiS { MatDestroy(&matIntInt); KSPDestroy(&kspInterior); - VecDestroy(&petscSolVec); + + if (petscSolVec != PETSC_NULL) + VecDestroy(&petscSolVec); + petscSolVec = PETSC_NULL; } diff --git a/AMDiS/src/parallel/PetscSolverGlobalMatrix.h b/AMDiS/src/parallel/PetscSolverGlobalMatrix.h index c04abe1ee20af2f765a219c18901f43880d7e3f3..caf3c9764c1fe98c4b1e279a5e152001237735c5 100644 --- a/AMDiS/src/parallel/PetscSolverGlobalMatrix.h +++ b/AMDiS/src/parallel/PetscSolverGlobalMatrix.h @@ -36,6 +36,7 @@ namespace AMDiS { public: PetscSolverGlobalMatrix() : PetscSolver(), + petscSolVec(PETSC_NULL), d_nnz(NULL), o_nnz(NULL), lastMeshNnz(0),