Salome HOME
Memory leaks hunting
authorageay <ageay>
Wed, 26 Jun 2013 05:30:57 +0000 (05:30 +0000)
committerageay <ageay>
Wed, 26 Jun 2013 05:30:57 +0000 (05:30 +0000)
src/MEDCoupling/MEDCouplingMemArray.cxx
src/MEDLoader/MEDLoader.cxx

index 3d923508d50b5a0f924ceec07cf9d8d4cc9cf7fc..d3354f7fa59fe3f4f7e3f53d3b955a56eb4976a8 100644 (file)
@@ -1805,6 +1805,7 @@ bool DataArrayDouble::areIncludedInMe(const DataArrayDouble *other, double prec,
   MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> a=DataArrayDouble::Aggregate(this,other);
   DataArrayInt *c=0,*ci=0;
   a->findCommonTuples(prec,getNumberOfTuples(),c,ci);
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cSafe(c),ciSafe(ci);
   int newNbOfTuples=-1;
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids=DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(a->getNumberOfTuples(),c->begin(),ci->begin(),ci->end(),newNbOfTuples);
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1=ids->selectByTupleId2(getNumberOfTuples(),a->getNumberOfTuples(),1);
index ee807d0274c6f22710fcc1d48fbeca0d2bd6bc9c..dfcc4a8028603dfab16513c2e19eccbc5ba01dc0 100644 (file)
@@ -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<MEDFileUMesh> m=MEDFileUMesh::New();
-  m->setMeshAtLevel(0,static_cast<MEDCouplingUMesh *>(mesh->deepCpy()),true);
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mcpy(static_cast<MEDCouplingUMesh *>(mesh->deepCpy()));
+  m->setMeshAtLevel(0,mcpy,true);
   m->write(fileName,mod);
 }