Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Change malloc/free to new/delete.
[simgrid.git] / src / smpi / colls / bcast / bcast-scatter-rdb-allgather.cpp
index df78b16..d8cb946 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2011-2019. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -162,15 +162,15 @@ Coll_bcast_scatter_rdb_allgather::bcast (
     }
     else
     {
-        tmp_buf=(void*)xbt_malloc(nbytes);
-
-        /* TODO: Pipeline the packing and communication */
-        position = 0;
-        if (rank == root) {
-            mpi_errno = datatype->pack(buffer, count, tmp_buf, nbytes,
-                                       &position, comm);
-            if (mpi_errno) xbt_die("crash while packing %d", mpi_errno);
-        }
+      tmp_buf = new unsigned char[nbytes];
+
+      /* TODO: Pipeline the packing and communication */
+      position = 0;
+      if (rank == root) {
+        mpi_errno = datatype->pack(buffer, count, tmp_buf, nbytes, &position, comm);
+        if (mpi_errno)
+          xbt_die("crash while packing %d", mpi_errno);
+      }
     }
 
 
@@ -334,8 +334,8 @@ Coll_bcast_scatter_rdb_allgather::bcast (
     }
 
 fn_exit:
-/*    xbt_free(tmp_buf);*/
-    return mpi_errno;
+  /* delete[] static_cast<unsigned char*>(tmp_buf); */
+  return mpi_errno;
 }
 
 }