Skip to content

Commit 548ed56

Browse files
authored
Merge pull request #7332 from hoopoepg/topic/fixed-coverity-issues
SPML/UCX: fixed coverity issues
2 parents f16d290 + 8543860 commit 548ed56

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

oshmem/mca/spml/ucx/spml_ucx.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,10 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs)
323323

324324
opal_progress_register(spml_ucx_default_progress);
325325

326-
mca_spml_ucx.remote_addrs_tbl = (char ***)calloc(mca_spml_ucx.ucp_workers, sizeof(char ***));
326+
mca_spml_ucx.remote_addrs_tbl = (char ***)calloc(mca_spml_ucx.ucp_workers,
327+
sizeof(mca_spml_ucx.remote_addrs_tbl[0]));
327328
for (w = 0; w < ucp_workers; w++) {
328-
mca_spml_ucx.remote_addrs_tbl[w] = (char **)calloc(nprocs, sizeof(char **));
329-
memset(mca_spml_ucx.remote_addrs_tbl[w], 0, nprocs * sizeof(char **));
329+
mca_spml_ucx.remote_addrs_tbl[w] = (char **)calloc(nprocs, sizeof(mca_spml_ucx.remote_addrs_tbl[w][0]));
330330
}
331331

332332
/* Store all remote addresses */
@@ -369,6 +369,8 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs)
369369
free(wk_raddrs);
370370
free(wk_rsizes);
371371
free(wk_roffs);
372+
free(wk_addr_len);
373+
free(wk_local_addr);
372374

373375
SPML_UCX_VERBOSE(50, "*** ADDED PROCS ***");
374376

@@ -404,6 +406,8 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs)
404406
free(wk_rsizes);
405407
free(wk_roffs);
406408
error:
409+
free(wk_addr_len);
410+
free(wk_local_addr);
407411
rc = OSHMEM_ERR_OUT_OF_RESOURCE;
408412
SPML_UCX_ERROR("add procs FAILED rc=%d", rc);
409413
return rc;

0 commit comments

Comments
 (0)