Skip to content

Commit 4424938

Browse files
author
David Wootton
committed
Fix possible memory leaks in component_select (osc_sm_component.c)
Coverity CID 1490191 Signed-off-by: David Wootton <dwootton@us.ibm.com>
1 parent 15ba702 commit 4424938

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)