From bca5c47920fb74013c9bf1a576235934861ab6ae Mon Sep 17 00:00:00 2001 From: ageay Date: Wed, 26 Jun 2013 05:30:57 +0000 Subject: [PATCH] Memory leaks hunting --- src/MEDCoupling/MEDCouplingMemArray.cxx | 1 + src/MEDLoader/MEDLoader.cxx | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index 3d923508d..d3354f7fa 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -1805,6 +1805,7 @@ bool DataArrayDouble::areIncludedInMe(const DataArrayDouble *other, double prec, MEDCouplingAutoRefCountObjectPtr a=DataArrayDouble::Aggregate(this,other); DataArrayInt *c=0,*ci=0; a->findCommonTuples(prec,getNumberOfTuples(),c,ci); + MEDCouplingAutoRefCountObjectPtr cSafe(c),ciSafe(ci); int newNbOfTuples=-1; MEDCouplingAutoRefCountObjectPtr ids=DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(a->getNumberOfTuples(),c->begin(),ci->begin(),ci->end(),newNbOfTuples); MEDCouplingAutoRefCountObjectPtr ret1=ids->selectByTupleId2(getNumberOfTuples(),a->getNumberOfTuples(),1); diff --git a/src/MEDLoader/MEDLoader.cxx b/src/MEDLoader/MEDLoader.cxx index ee807d027..dfcc4a802 100644 --- a/src/MEDLoader/MEDLoader.cxx +++ b/src/MEDLoader/MEDLoader.cxx @@ -1278,7 +1278,8 @@ void MEDLoader::WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUM throw INTERP_KERNEL::Exception("MEDLoader::WriteUMesh : input mesh is null !"); int mod=writeFromScratch?2:0; MEDCouplingAutoRefCountObjectPtr m=MEDFileUMesh::New(); - m->setMeshAtLevel(0,static_cast(mesh->deepCpy()),true); + MEDCouplingAutoRefCountObjectPtr mcpy(static_cast(mesh->deepCpy())); + m->setMeshAtLevel(0,mcpy,true); m->write(fileName,mod); } -- 2.39.2