Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[codacy/cppcheck] A few more issues.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 4 Feb 2019 10:01:22 +0000 (11:01 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 4 Feb 2019 10:01:22 +0000 (11:01 +0100)
src/smpi/colls/coll_tuned_topo.cpp
src/smpi/colls/smpi_mvapich2_selector.cpp

index 27f20da..0236803 100644 (file)
@@ -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;
     }
 
index f3c697b..e755f00 100644 (file)
@@ -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;