Salome HOME
Memory leak fix on MPI_Group and when throwing in MPIProcessorGroup.
[modules/med.git] / src / ParaMEDMEMTest / ParaMEDMEMTest_MPIProcessorGroup.cxx
index 64b68cc6b51740155c6938cf30f4b0ba564a201b..3c6fc3b257ce4d10866109aa845099ec14a6e64e 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2012  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
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -58,18 +58,20 @@ using namespace ParaMEDMEM;
 void ParaMEDMEMTest::testMPIProcessorGroup_constructor()
 {
   CommInterface comm_interface;
-  MPIProcessorGroup* group= new MPIProcessorGroup(comm_interface);
+  MPIProcessorGroup* group;
   int size;
   MPI_Comm_size(MPI_COMM_WORLD, &size);
+
+  group= new MPIProcessorGroup(comm_interface);
   CPPUNIT_ASSERT_EQUAL(size,group->size());
   int size2;
   const MPI_Comm* communicator=group->getComm();
   MPI_Comm_size(*communicator, &size2);
   CPPUNIT_ASSERT_EQUAL(size,size2);
   delete group;
-  
+
   set <int> procs;
-  
+
   procs.insert(0);
   procs.insert(1);
   if (size==1)
@@ -80,8 +82,7 @@ void ParaMEDMEMTest::testMPIProcessorGroup_constructor()
       CPPUNIT_ASSERT_EQUAL (group->size(),2);
       delete group;
     }
-  
-  
+
   //throws because plast<pfirst
   CPPUNIT_ASSERT_THROW(group=new MPIProcessorGroup(comm_interface,1,0),INTERP_KERNEL::Exception);
   //throws because plast is beyond size-1
@@ -92,7 +93,7 @@ void ParaMEDMEMTest::testMPIProcessorGroup_constructor()
       CPPUNIT_ASSERT_EQUAL(group->size(),size-1);
       delete group;
     }
-  
+
 }
  
 void ParaMEDMEMTest::testMPIProcessorGroup_boolean()