From: Arnaud Giersch Date: Mon, 4 Feb 2019 10:01:22 +0000 (+0100) Subject: [codacy/cppcheck] A few more issues. X-Git-Tag: v3_22~392^2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/7f200d65d5465c61e8c1b38b1864c5e229594f4c?hp=33486e78305d65ff8eb5f4bd2b3b52decfad242e [codacy/cppcheck] A few more issues. --- diff --git a/src/smpi/colls/coll_tuned_topo.cpp b/src/smpi/colls/coll_tuned_topo.cpp index 27f20da01b..0236803ca9 100644 --- a/src/smpi/colls/coll_tuned_topo.cpp +++ b/src/smpi/colls/coll_tuned_topo.cpp @@ -380,6 +380,7 @@ ompi_coll_tuned_topo_build_bmtree( MPI_Comm comm, if( remote >= size ) remote -= size; if (childs==MAXTREEFANOUT) { XBT_DEBUG("coll:tuned:topo:build_bmtree max fanout incorrect %d needed %d", MAXTREEFANOUT, childs); + delete bmtree; return NULL; } bmtree->tree_next[childs] = remote; @@ -427,6 +428,7 @@ ompi_coll_tree_t* ompi_coll_tuned_topo_build_in_order_bmtree(MPI_Comm comm, int bmtree = new ompi_coll_tree_t; if (not bmtree) { XBT_DEBUG("coll:tuned:topo:build_bmtree PANIC out of memory"); + delete bmtree; return NULL; } diff --git a/src/smpi/colls/smpi_mvapich2_selector.cpp b/src/smpi/colls/smpi_mvapich2_selector.cpp index f3c697bf71..e755f008c8 100644 --- a/src/smpi/colls/smpi_mvapich2_selector.cpp +++ b/src/smpi/colls/smpi_mvapich2_selector.cpp @@ -201,16 +201,15 @@ int Coll_gather_mvapich2::gather(void *sendbuf, int range_threshold = 0; int range_intra_threshold = 0; long nbytes = 0; - int recvtype_size, sendtype_size; int comm_size = comm->size(); int rank = comm->rank(); if (rank == root) { - recvtype_size=recvtype->size(); - nbytes = recvcnt * recvtype_size; + int recvtype_size = recvtype->size(); + nbytes = recvcnt * recvtype_size; } else { - sendtype_size=sendtype->size(); - nbytes = sendcnt * sendtype_size; + int sendtype_size = sendtype->size(); + nbytes = sendcnt * sendtype_size; } /* Search for the corresponding system size inside the tuning table */ @@ -896,12 +895,12 @@ int Coll_scatter_mvapich2::scatter(void *sendbuf, if (comm->is_uniform()) { shmem_comm = comm->get_intra_comm(); - int local_size = shmem_comm->size(); - int i = 0; if (mv2_scatter_table_ppn_conf[0] == -1) { // Indicating user defined tuning conf_index = 0; }else{ + int local_size = shmem_comm->size(); + int i = 0; do { if (local_size == mv2_scatter_table_ppn_conf[i]) { conf_index = i;