]> AND Public Git Repository - simgrid.git/blobdiff - src/smpi/colls/bcast/bcast-flattree.cpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'tracemgrsplit' into 'master'
[simgrid.git] / src / smpi / colls / bcast / bcast-flattree.cpp
index 7178f2a21b2eed0e877a19b8ac7e82a11bc25fd7..175c8751f9529abb9bbaca6c672b09154d4776af 100644 (file)
@@ -11,9 +11,6 @@ int
 Coll_bcast_flattree::bcast(void *buff, int count, MPI_Datatype data_type,
                                int root, MPI_Comm comm)
 {
-  MPI_Request *req_ptr;
-  MPI_Request *reqs;
-
   int i, rank, num_procs;
   int tag = COLL_TAG_BCAST;
 
@@ -25,8 +22,8 @@ Coll_bcast_flattree::bcast(void *buff, int count, MPI_Datatype data_type,
   }
 
   else {
-    reqs = (MPI_Request *) xbt_malloc((num_procs - 1) * sizeof(MPI_Request));
-    req_ptr = reqs;
+    MPI_Request* reqs    = new MPI_Request[num_procs - 1];
+    MPI_Request* req_ptr = reqs;
 
     // Root sends data to all others
     for (i = 0; i < num_procs; i++) {
@@ -38,7 +35,7 @@ Coll_bcast_flattree::bcast(void *buff, int count, MPI_Datatype data_type,
     // wait on all requests
     Request::waitall(num_procs - 1, reqs, MPI_STATUSES_IGNORE);
 
-    free(reqs);
+    delete[] reqs;
   }
   return MPI_SUCCESS;
 }