From 4a4884ead9a3d55f9247a3facc7b310f1a0fe942 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Fri, 20 Dec 2019 22:05:03 +0100 Subject: [PATCH] [sonar] A single statement should not have more than one resource allocation. --- src/include/xbt/parmap.hpp | 3 ++- src/smpi/mpi/smpi_topo.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) 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; } -- 2.20.1