From 00864d32c0a423ac95eec8722d9fa41a1f44d80c Mon Sep 17 00:00:00 2001 From: ageay Date: Fri, 17 Feb 2012 07:53:49 +0000 Subject: [PATCH] Bug correction : memory leak. --- src/MEDLoader/MEDFileMesh.cxx | 1 - src/MEDLoader/Swig/MEDLoader.i | 9 ++++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index bc19d8f8a..52d8bde4a 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -1301,7 +1301,6 @@ DataArrayDouble *MEDFileUMesh::getCoords() const MEDCouplingAutoRefCountObjectPtr tmp(_coords); if((DataArrayDouble *)tmp) { - tmp->incrRef(); return tmp; } return 0; diff --git a/src/MEDLoader/Swig/MEDLoader.i b/src/MEDLoader/Swig/MEDLoader.i index c9d9894ce..d27f2ab59 100644 --- a/src/MEDLoader/Swig/MEDLoader.i +++ b/src/MEDLoader/Swig/MEDLoader.i @@ -469,7 +469,6 @@ namespace ParaMEDMEM std::vector getFamsNonEmptyLevels(const std::vector& fams) const throw(INTERP_KERNEL::Exception); std::vector getFamsNonEmptyLevelsExt(const std::vector& fams) const throw(INTERP_KERNEL::Exception); std::vector getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception); - DataArrayDouble *getCoords() const; MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception); DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false) const throw(INTERP_KERNEL::Exception); @@ -515,6 +514,14 @@ namespace ParaMEDMEM convertPyObjToVecDataArrayIntCst(li,grps); self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum); } + + DataArrayDouble *getCoords() const + { + DataArrayDouble *ret=self->getCoords(); + if(ret) + ret->incrRef(); + return ret; + } } }; -- 2.39.2