From c9594e3ef0158b1a1c418ae8724b14afc4522748 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Sat, 5 Nov 2022 18:08:28 -0400 Subject: [PATCH] ofi/common: close memory base in an error path related to #10975 Signed-off-by: Howard Pritchard --- opal/mca/common/ofi/common_ofi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/opal/mca/common/ofi/common_ofi.c b/opal/mca/common/ofi/common_ofi.c index 6df4a6e07b4..d93d2627342 100644 --- a/opal/mca/common/ofi/common_ofi.c +++ b/opal/mca/common/ofi/common_ofi.c @@ -121,6 +121,7 @@ int opal_common_ofi_export_memory_monitor(void) int ret = -FI_ENOSYS; #ifdef HAVE_STRUCT_FI_OPS_MEM_MONITOR + bool memory_base_frame_open = false; OPAL_THREAD_LOCK(&opal_common_ofi_mutex); if (NULL != opal_common_ofi_cache_fid) { @@ -145,7 +146,10 @@ int opal_common_ofi_export_memory_monitor(void) if (OPAL_SUCCESS != ret) { ret = -FI_ENOSYS; goto err; + } else { + memory_base_frame_open = true; } + if ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) != (((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT)) & opal_mem_hooks_support_level())) { @@ -190,6 +194,9 @@ int opal_common_ofi_export_memory_monitor(void) free(opal_common_ofi_monitor); } + if (memory_base_frame_open) { + mca_base_framework_close(&opal_memory_base_framework); + } opal_common_ofi_installed_memory_monitor = false; }