s_smpi_subtype_t *subtype = datatype->substruct;
if(datatype->has_subtype == 1){
- // This part handles the problem of non-contignous memory
+ // This part handles the problem of non-contiguous memory
old_buf = buf;
buf = malloc(count*smpi_datatype_size(datatype));
if (flags & SEND) {
}
request->buf = buf;
- // This part handles the problem of non-contignous memory (for the
+ // This part handles the problem of non-contiguous memory (for the
// unserialisation at the reception)
request->old_buf = old_buf;
request->old_type = datatype;
if(request->old_type->has_subtype == 0){
oldbuf = request->buf;
request->detached = 1;
- request->buf = malloc(request->size);
- if (oldbuf)
+ if (oldbuf){
+ request->buf = malloc(request->size);
memcpy(request->buf,oldbuf,request->size);
+ }
}
XBT_DEBUG("Send request %p is detached; buf %p copied into %p",request,oldbuf,request->buf);
}