Skip to content

Commit 4145b9f

Browse files
author
Sergey Oblomov
committed
PML/UCX/DATATYPE: fixed memory leak
- fixed memory leak in datatype processing Signed-off-by: Sergey Oblomov <sergeyo@nvidia.com>
1 parent 6d237e8 commit 4145b9f

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

ompi/mca/pml/ucx/pml_ucx_datatype.c

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -220,18 +220,23 @@ ucp_datatype_t mca_pml_ucx_init_datatype(ompi_datatype_t *datatype)
220220
if (mca_pml_ucx_datatype_is_contig(datatype)) {
221221
ompi_datatype_type_size(datatype, &size);
222222
ucp_datatype = ucp_dt_make_contig(size);
223-
goto out;
224-
}
225-
226-
status = ucp_dt_create_generic(&pml_ucx_generic_datatype_ops,
227-
datatype, &ucp_datatype);
228-
if (status != UCS_OK) {
229-
int err = MPI_ERR_INTERN;
230-
PML_UCX_ERROR("Failed to create UCX datatype for %s", datatype->name);
231-
/* TODO: this error should return to the caller and invoke an error
232-
* handler from the MPI API call.
233-
* For now, it is fatal. */
234-
ompi_mpi_errors_are_fatal_comm_handler(NULL, &err, "Failed to allocate datatype structure");
223+
PML_UCX_VERBOSE(7, "created contig UCX datatype 0x%"PRIx64,
224+
ucp_datatype)
225+
} else {
226+
status = ucp_dt_create_generic(&pml_ucx_generic_datatype_ops,
227+
datatype, &ucp_datatype);
228+
if (status != UCS_OK) {
229+
int err = MPI_ERR_INTERN;
230+
PML_UCX_ERROR("Failed to create UCX datatype for %s",
231+
datatype->name);
232+
/* TODO: this error should return to the caller and invoke an error
233+
* handler from the MPI API call.
234+
* For now, it is fatal. */
235+
ompi_mpi_errors_are_fatal_comm_handler(NULL, &err,
236+
"Failed to allocate "
237+
"datatype structure");
238+
}
239+
PML_UCX_VERBOSE(7, "created generic UCX datatype 0x%"PRIx64, ucp_datatype)
235240
}
236241

237242
/* Add custom attribute, to clean up UCX resources when OMPI datatype is
@@ -254,8 +259,6 @@ ucp_datatype_t mca_pml_ucx_init_datatype(ompi_datatype_t *datatype)
254259
ompi_mpi_errors_are_fatal_comm_handler(NULL, &err, "Failed to allocate datatype structure");
255260
}
256261
}
257-
out:
258-
PML_UCX_VERBOSE(7, "created generic UCX datatype 0x%"PRIx64, ucp_datatype)
259262

260263
#ifdef HAVE_UCP_REQUEST_PARAM_T
261264
UCS_STATIC_ASSERT(sizeof(datatype->pml_data) >= sizeof(pml_ucx_datatype_t*));

0 commit comments

Comments
 (0)