Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] A single statement should not have more than one resource allocation.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 20 Dec 2019 21:05:03 +0000 (22:05 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 20 Dec 2019 21:05:03 +0000 (22:05 +0100)
src/include/xbt/parmap.hpp
src/smpi/mpi/smpi_topo.cpp

index ec4fdc8..18bf58d 100644 (file)
@@ -171,7 +171,8 @@ template <typename T> Parmap<T>::Parmap(unsigned num_workers, e_xbt_parmap_mode_
   XBT_ATTRIB_UNUSED unsigned int core_bind = 0;
 
   for (unsigned i = 1; i < num_workers; i++) {
   XBT_ATTRIB_UNUSED unsigned int core_bind = 0;
 
   for (unsigned i = 1; i < num_workers; i++) {
-    this->workers[i] = new std::thread(worker_main, new ThreadData(*this, i));
+    ThreadData* data = new ThreadData(*this, i);
+    this->workers[i] = new std::thread(worker_main, data);
 
     /* Bind the worker to a core if possible */
 #if HAVE_PTHREAD_SETAFFINITY
 
     /* Bind the worker to a core if possible */
 #if HAVE_PTHREAD_SETAFFINITY
index 424e349..b79cefc 100644 (file)
@@ -80,7 +80,8 @@ Topo_Cart::Topo_Cart(MPI_Comm comm_old, int ndims, const int dims[], const int p
   } else {
     if(comm_cart != nullptr){
       if (rank == 0) {
   } else {
     if(comm_cart != nullptr){
       if (rank == 0) {
-        *comm_cart = new  Comm(new  Group(MPI_COMM_SELF->group()), this);
+        MPI_Group group = new Group(MPI_COMM_SELF->group());
+        *comm_cart      = new Comm(group, this);
       } else {
         *comm_cart = MPI_COMM_NULL;
       }
       } else {
         *comm_cart = MPI_COMM_NULL;
       }