From a2466d19e2425780a8b683f3cc1d33bd4f8c562d Mon Sep 17 00:00:00 2001 From: abn Date: Thu, 22 Oct 2015 15:22:02 +0200 Subject: [PATCH] Mem leak fix in OverlapDEC. --- src/ParaMEDMEM/OverlapDEC.cxx | 21 ++++++++++++++------- src/ParaMEDMEM/OverlapDEC.hxx | 1 + 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/ParaMEDMEM/OverlapDEC.cxx b/src/ParaMEDMEM/OverlapDEC.cxx index c799c23aa..0c02028d7 100644 --- a/src/ParaMEDMEM/OverlapDEC.cxx +++ b/src/ParaMEDMEM/OverlapDEC.cxx @@ -203,9 +203,11 @@ namespace ParaMEDMEM The method in charge to perform this is : ParaMEDMEM::OverlapMapping::prepare. */ - OverlapDEC::OverlapDEC(const std::set& procIds, const MPI_Comm& world_comm):_own_group(true),_interpolation_matrix(0), - _source_field(0),_own_source_field(false), - _target_field(0),_own_target_field(false) + OverlapDEC::OverlapDEC(const std::set& procIds, const MPI_Comm& world_comm): + _own_group(true),_interpolation_matrix(0), + _source_field(0),_own_source_field(false), + _target_field(0),_own_target_field(false), + _comm(MPI_COMM_NULL) { ParaMEDMEM::CommInterface comm; int *ranks_world=new int[procIds.size()]; // ranks of sources and targets in world_comm @@ -214,10 +216,10 @@ namespace ParaMEDMEM comm.commGroup(world_comm,&world_group); comm.groupIncl(world_group,procIds.size(),ranks_world,&group); delete [] ranks_world; - MPI_Comm theComm; - comm.commCreate(world_comm,group,&theComm); + comm.commCreate(world_comm,group,&_comm); comm.groupFree(&group); - if(theComm==MPI_COMM_NULL) + comm.groupFree(&world_group); + if(_comm==MPI_COMM_NULL) { _group=0; return ; @@ -225,7 +227,7 @@ namespace ParaMEDMEM std::set idsUnion; for(std::size_t i=0;i