From: Arnaud Giersch Date: Fri, 22 Nov 2019 15:19:32 +0000 (+0100) Subject: Memory leak-- X-Git-Tag: v3.25~367 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/cbaf3d378e0b066dcac9ee64a804619e7ff3bd55 Memory leak-- --- diff --git a/src/smpi/mpi/smpi_topo.cpp b/src/smpi/mpi/smpi_topo.cpp index 710eaafe94..9a814961d1 100644 --- a/src/smpi/mpi/smpi_topo.cpp +++ b/src/smpi/mpi/smpi_topo.cpp @@ -167,10 +167,8 @@ int Topo_Cart::rank(const int* coords, int* rank) { return MPI_SUCCESS; } -int Topo_Cart::shift(int direction, int disp, int *rank_source, int *rank_dest) { - - int* position = new int[ndims_]; - +int Topo_Cart::shift(int direction, int disp, int* rank_source, int* rank_dest) +{ if(ndims_ == 0) { return MPI_ERR_ARG; } @@ -178,6 +176,7 @@ int Topo_Cart::shift(int direction, int disp, int *rank_source, int *rank_dest) return MPI_ERR_DIMS; } + int* position = new int[ndims_]; this->coords(getComm()->rank(), ndims_, position); position[direction] += disp;