From: SUTER Frederic Date: Wed, 27 Oct 2021 07:52:34 +0000 (+0200) Subject: [sonar] use shared_ptr instead of new/delete X-Git-Tag: v3.30~299 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/ae9ecde63e23c708bffdf472ab4c8eb77576614c [sonar] use shared_ptr instead of new/delete --- diff --git a/src/smpi/internals/smpi_deployment.cpp b/src/smpi/internals/smpi_deployment.cpp index 4fbc3a1a93..526ee28674 100644 --- a/src/smpi/internals/smpi_deployment.cpp +++ b/src/smpi/internals/smpi_deployment.cpp @@ -26,9 +26,9 @@ public: auto* group = new simgrid::smpi::Group(size_); comm_world_ = new simgrid::smpi::Comm(group, nullptr, false, -1); universe_size += max_no_processes; - bar_ = new s4u::Barrier(size_); + bar_ = std::make_shared(size_); } - s4u::Barrier* bar_; + std::shared_ptr bar_; unsigned int size_; unsigned int finalized_ranks_ = 0; MPI_Comm comm_world_; @@ -80,7 +80,6 @@ void smpi_deployment_unregister_process(const std::string& instance_id) if (instance.finalized_ranks_ == instance.size_) { simgrid::smpi::Comm::destroy(instance.comm_world_); - delete instance.bar_; smpi_instances.erase(instance_id); } }