Skip to content

Commit bfd8893

Browse files
authored
Merge pull request #11135 from drwootton/sm_component_leak
Fix memory leak in component_select in osc_sm_component.c
2 parents 1e5f8e1 + 5f2d633 commit bfd8893

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ompi/mca/osc/sm/osc_sm_component.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit
275275
module->noncontig = false;
276276
if (OMPI_SUCCESS != opal_info_get_bool(info, "alloc_shared_noncontig",
277277
&module->noncontig, &flag)) {
278+
free(rbuf);
278279
goto error;
279280
}
280281

@@ -291,7 +292,10 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit
291292
rbuf, 1, MPI_UNSIGNED_LONG,
292293
module->comm,
293294
module->comm->c_coll->coll_allgather_module);
294-
if (OMPI_SUCCESS != ret) return ret;
295+
if (OMPI_SUCCESS != ret) {
296+
free(rbuf);
297+
return ret;
298+
}
295299

296300
total = 0;
297301
for (i = 0 ; i < comm_size ; ++i) {

0 commit comments

Comments
 (0)