X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a468c44a3ff64c8252a45ba0c4d8fea2c147491b..c94e821e152ba209559e8b646a70c4a77849f13e:/src/smpi/smpi_base.c diff --git a/src/smpi/smpi_base.c b/src/smpi/smpi_base.c index d7d32fcdd3..f5a219247d 100644 --- a/src/smpi/smpi_base.c +++ b/src/smpi/smpi_base.c @@ -197,7 +197,7 @@ static MPI_Request build_request(void *buf, int count, if(datatype->has_subtype == 1){ // This part handles the problem of non-contiguous memory old_buf = buf; - buf = xbt_malloc(count*smpi_datatype_size(datatype)); + buf = count==0 ? NULL : xbt_malloc(count*smpi_datatype_size(datatype)); if (flags & SEND) { subtype->serialize(old_buf, buf, count, datatype->substruct); } @@ -362,7 +362,7 @@ void smpi_mpi_start(MPI_Request request) request->refcount++; if(request->old_type->has_subtype == 0){ oldbuf = request->buf; - if (oldbuf){ + if (oldbuf && request->size!=0){ request->buf = xbt_malloc(request->size); memcpy(request->buf,oldbuf,request->size); }