Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] s/NULL/nullptr.
[simgrid.git] / examples / smpi / ampi_test / ampi_test.cpp
index 78d132a066cf0a0f17702ff73eeebc4f10a6be48..e3a8cf421c7e96219be38a0e56e05fb37235622f 100644 (file)
 int main(int argc, char* argv[])
 {
   MPI_Init(&argc, &argv);
+  // useless alocations for testing and coverage
   void* pointer = malloc(100 * sizeof(int));
+  void* ptmp;
+  if ((ptmp = realloc(pointer, 50 * sizeof(int))) != nullptr)
+    pointer = ptmp;
+  if ((ptmp = realloc(pointer, 200 * sizeof(int))) != nullptr)
+    pointer = ptmp;
   free(pointer);
-  pointer = malloc(100 * sizeof(int));
+  pointer = calloc(100, sizeof(int));
   int rank;
   int err = MPI_Comm_rank(MPI_COMM_WORLD, &rank);   /* Get id of this process */
   if (err != MPI_SUCCESS) {