From: michael Date: Wed, 18 Nov 2020 12:24:21 +0000 (+0100) Subject: Corrected important memory leak X-Git-Tag: V9_6_0~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=00afac99387d392be2d610b4649bfbfb52328a49;p=tools%2Fsolverlab.git Corrected important memory leak --- diff --git a/CDMATH/linearsolver/src/SparseMatrixPetsc.cxx b/CDMATH/linearsolver/src/SparseMatrixPetsc.cxx old mode 100644 new mode 100755 index 31a943c..651a744 --- a/CDMATH/linearsolver/src/SparseMatrixPetsc.cxx +++ b/CDMATH/linearsolver/src/SparseMatrixPetsc.cxx @@ -340,8 +340,16 @@ SparseMatrixPetsc::operator* (const Vector& vec) const MatAssemblyBegin(_mat, MAT_FINAL_ASSEMBLY); MatAssemblyEnd(_mat, MAT_FINAL_ASSEMBLY); MatMult(_mat,X,Y); + + //Clean memory + VecDestroy(&X); - return vecToVector(Y); + Vector result=vecToVector(Y); + + //Clean memory + VecDestroy(&Y); + + return result; } SparseMatrixPetsc&