X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FParaMEDMEM%2FMPIProcessorGroup.cxx;h=055cc5122c8608a2244eafcd13a6ca632fff28e9;hb=a843e859241baea9b4942877174422d2891206ef;hp=cb96a69985c008e10847883e7dad5201fed09b35;hpb=8763c12d01e33d6845dd53be65b001514d00bd42;p=tools%2Fmedcoupling.git diff --git a/src/ParaMEDMEM/MPIProcessorGroup.cxx b/src/ParaMEDMEM/MPIProcessorGroup.cxx index cb96a6998..055cc5122 100644 --- a/src/ParaMEDMEM/MPIProcessorGroup.cxx +++ b/src/ParaMEDMEM/MPIProcessorGroup.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -110,12 +110,19 @@ namespace ParaMEDMEM copy::const_iterator,int*> (_proc_ids.begin(), _proc_ids.end(), ranks); for (int i=0; i< (int)_proc_ids.size();i++) if (ranks[i]>size_world-1) - throw INTERP_KERNEL::Exception("invalid rank in set argument of MPIProcessorGroup constructor"); + { + delete[] ranks; + _comm_interface.groupFree(&group_world); // MPI_Group is a C structure and won't get de-allocated automatically? + throw INTERP_KERNEL::Exception("invalid rank in set argument of MPIProcessorGroup constructor"); + } _comm_interface.groupIncl(group_world, _proc_ids.size(), ranks, &_group); _comm_interface.commCreate(_world_comm, _group, &_comm); + + // clean-up delete[] ranks; + _comm_interface.groupFree(&group_world); // MPI_Group is a C structure and won't get de-allocated automatically? } /*! Creates a processor group that is based on the processors between \a pstart and \a pend. @@ -138,7 +145,10 @@ namespace ParaMEDMEM _comm_interface.commGroup(_world_comm, &group_world); if (pend>size_world-1 || pend