Skip to content

Commit 5ebcbe4

Browse files
authored
Merge pull request #6083 from devreal/rdma-plug-memleak
Plug two memory leaks in rdma osc
2 parents 27084c6 + 91885f5 commit 5ebcbe4

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

ompi/mca/osc/rdma/osc_rdma_component.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -586,16 +586,16 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s
586586
}
587587
}
588588

589-
/* allocate the shared memory segment */
590-
ret = opal_asprintf (&data_file, "%s" OPAL_PATH_SEP "osc_rdma.%s.%x.%d",
591-
mca_osc_rdma_component.backing_directory, ompi_process_info.nodename,
592-
OMPI_PROC_MY_NAME->jobid, ompi_comm_get_cid(module->comm));
593-
if (0 > ret) {
594-
ret = OMPI_ERR_OUT_OF_RESOURCE;
595-
break;
596-
}
597-
598589
if (0 == local_rank) {
590+
/* allocate the shared memory segment */
591+
ret = opal_asprintf (&data_file, "%s" OPAL_PATH_SEP "osc_rdma.%s.%x.%d",
592+
mca_osc_rdma_component.backing_directory, ompi_process_info.nodename,
593+
OMPI_PROC_MY_NAME->jobid, ompi_comm_get_cid(module->comm));
594+
if (0 > ret) {
595+
ret = OMPI_ERR_OUT_OF_RESOURCE;
596+
break;
597+
}
598+
599599
/* allocate enough space for the state + data for all local ranks */
600600
ret = opal_shmem_segment_create (&module->seg_ds, data_file, total_size);
601601
free (data_file);

ompi/mca/osc/rdma/osc_rdma_module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ int ompi_osc_rdma_free(ompi_win_t *win)
111111

112112
OBJ_DESTRUCT(&module->peer_hash);
113113
} else if (NULL != module->comm) {
114-
for (int i = 0 ; i < ompi_comm_rank (module->comm) ; ++i) {
114+
for (int i = 0 ; i < ompi_comm_size (module->comm) ; ++i) {
115115
if (NULL != module->peer_array[i]) {
116116
OBJ_RELEASE(module->peer_array[i]);
117117
}

0 commit comments

Comments
 (0)