Skip to content

Commit 40f0014

Browse files
committed
mtl/ofi: Prevent possible memory leak.
(cherry-picked from open-mpi/ompi@3ad5943)
1 parent fb2d59e commit 40f0014

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ompi/mca/mtl/ofi/mtl_ofi.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,11 +861,13 @@ ompi_mtl_ofi_improbe(struct mca_mtl_base_module_t *mtl,
861861
* The search request completed but no matching message was found.
862862
*/
863863
*matched = 0;
864+
free(ofi_req);
864865
return OMPI_SUCCESS;
865866
} else if (OPAL_UNLIKELY(0 > ret)) {
866867
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
867868
"%s:%d: fi_trecvmsg failed: %s(%zd)",
868869
__FILE__, __LINE__, fi_strerror(-ret), ret);
870+
free(ofi_req);
869871
return ompi_mtl_ofi_get_error(ret);
870872
}
871873

@@ -891,6 +893,7 @@ ompi_mtl_ofi_improbe(struct mca_mtl_base_module_t *mtl,
891893

892894
} else {
893895
(*message) = MPI_MESSAGE_NULL;
896+
free(ofi_req);
894897
}
895898

896899
return OMPI_SUCCESS;

0 commit comments

Comments
 (0)