From: Arnaud Giersch Date: Fri, 20 Dec 2019 21:05:03 +0000 (+0100) Subject: [sonar] A single statement should not have more than one resource allocation. X-Git-Tag: v3.25~250 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/4a4884ead9a3d55f9247a3facc7b310f1a0fe942?ds=sidebyside [sonar] A single statement should not have more than one resource allocation. --- diff --git a/src/include/xbt/parmap.hpp b/src/include/xbt/parmap.hpp index ec4fdc81ac..18bf58d496 100644 --- a/src/include/xbt/parmap.hpp +++ b/src/include/xbt/parmap.hpp @@ -171,7 +171,8 @@ template Parmap::Parmap(unsigned num_workers, e_xbt_parmap_mode_ 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 diff --git a/src/smpi/mpi/smpi_topo.cpp b/src/smpi/mpi/smpi_topo.cpp index 424e3496ea..b79cefc5d3 100644 --- a/src/smpi/mpi/smpi_topo.cpp +++ b/src/smpi/mpi/smpi_topo.cpp @@ -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) { - *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; }