From: Augustin Degomme Date: Tue, 9 Apr 2013 09:23:28 +0000 (+0200) Subject: do not allocate 0 sized buffers which won't be copied/freed after X-Git-Tag: v3_9_90~412^2~35 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/c94e821e152ba209559e8b646a70c4a77849f13e?hp=2f17e329e19084133ea3fae7f06054b976f5c383 do not allocate 0 sized buffers which won't be copied/freed after --- diff --git a/src/smpi/smpi_base.c b/src/smpi/smpi_base.c index 6ffe7f6484..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); }