if (data->count <= 0) {
close(data->fd);
allocs.erase(allocs.find(meta->second.data->first));
- allocs_metadata.erase(ptr);
+ allocs_metadata.erase(meta);
XBT_DEBUG("Shared free - Local - with removal - of %p", ptr);
} else {
XBT_DEBUG("Shared free - Local - no removal - of %p, count = %d", ptr, data->count);
munmap(ptr, meta->second.size);
if(meta->second.data->second.count==0){
delete meta->second.data;
- allocs_metadata.erase(ptr);
+ allocs_metadata.erase(meta);
}
}else{
xbt_free(ptr);
} else if (elem.copy_fn.type_copy_fn != MPI_NULL_COPY_FN) {
ret = elem.copy_fn.type_copy_fn(datatype, it.first, elem.extra_state, it.second, &value_out, &flag);
}
+ if (ret != MPI_SUCCESS)
+ return ret;
+
if (elem.copy_fn.type_copy_fn_fort != MPI_NULL_COPY_FN) {
value_out = xbt_new(int, 1);
if (*(int*)*elem.copy_fn.type_copy_fn_fort == 1) { // MPI_TYPE_DUP_FN
} else { // not null, nor dup
elem.copy_fn.type_copy_fn_fort(datatype, it.first, elem.extra_state, it.second, value_out, &flag, &ret);
}
- if (ret != MPI_SUCCESS)
+ if (ret != MPI_SUCCESS) {
xbt_free(value_out);
+ return ret;
+ }
}
- if (ret != MPI_SUCCESS)
- return ret;
if (flag) {
elem.refcount++;
attributes().emplace(it.first, value_out);