From c94e821e152ba209559e8b646a70c4a77849f13e Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Tue, 9 Apr 2013 11:23:28 +0200 Subject: [PATCH 1/1] do not allocate 0 sized buffers which won't be copied/freed after --- src/smpi/smpi_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } -- 2.20.1