X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/eaaad0105110e645d840eaee5b231b0829f93e39..d99428fa04f869052710d05a61bed13281012d45:/src/smpi/colls/smpi_mpich_selector.cpp diff --git a/src/smpi/colls/smpi_mpich_selector.cpp b/src/smpi/colls/smpi_mpich_selector.cpp index 5e0dd828aa..11de9148b1 100644 --- a/src/smpi/colls/smpi_mpich_selector.cpp +++ b/src/smpi/colls/smpi_mpich_selector.cpp @@ -710,18 +710,14 @@ int Coll_scatter_mpich::scatter(const void *sbuf, int scount, int root, MPI_Comm comm ) { + std::unique_ptr tmp_buf; if(comm->rank()!=root){ - sbuf=xbt_malloc(rcount*rdtype->get_extent()); - scount=rcount; - sdtype=rdtype; + tmp_buf.reset(new unsigned char[rcount * rdtype->get_extent()]); + sbuf = tmp_buf.get(); + scount = rcount; + sdtype = rdtype; } - int ret= Coll_scatter_ompi_binomial::scatter (sbuf, scount, sdtype, - rbuf, rcount, rdtype, - root, comm); - if(comm->rank()!=root){ - xbt_free(const_cast(sbuf)); - } - return ret; + return Coll_scatter_ompi_binomial::scatter(sbuf, scount, sdtype, rbuf, rcount, rdtype, root, comm); } } }