Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Ensure malloc is not called with a size of 0.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 20 Dec 2019 22:57:22 +0000 (23:57 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 20 Dec 2019 22:57:22 +0000 (23:57 +0100)
src/smpi/mpi/smpi_comm.cpp
src/smpi/mpi/smpi_win.cpp

index 5248ee9..e4e9929 100644 (file)
@@ -424,6 +424,7 @@ void Comm::init_smp(){
       leader_group_size++;
     }
   }
+  xbt_assert(leader_group_size > 0);
   std::sort(leader_list, leader_list + leader_group_size);
 
   MPI_Group leaders_group = new  Group(leader_group_size);
index 4d74e82..c745029 100644 (file)
@@ -735,7 +735,7 @@ int Win::shared_query(int rank, MPI_Aint* size, int* disp_unit, void* baseptr)
     *static_cast<void**>(baseptr) = target_win->base_;
   } else {
     *size                         = 0;
-    *static_cast<void**>(baseptr) = xbt_malloc(0);
+    *static_cast<void**>(baseptr) = nullptr;
   }
   return MPI_SUCCESS;
 }