Skip to content

Commit c9594e3

Browse files
committed
ofi/common: close memory base in an error path
related to #10975 Signed-off-by: Howard Pritchard <[email protected]>
1 parent ff62b05 commit c9594e3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

opal/mca/common/ofi/common_ofi.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ int opal_common_ofi_export_memory_monitor(void)
121121
int ret = -FI_ENOSYS;
122122

123123
#ifdef HAVE_STRUCT_FI_OPS_MEM_MONITOR
124+
bool memory_base_frame_open = false;
124125
OPAL_THREAD_LOCK(&opal_common_ofi_mutex);
125126

126127
if (NULL != opal_common_ofi_cache_fid) {
@@ -145,7 +146,10 @@ int opal_common_ofi_export_memory_monitor(void)
145146
if (OPAL_SUCCESS != ret) {
146147
ret = -FI_ENOSYS;
147148
goto err;
149+
} else {
150+
memory_base_frame_open = true;
148151
}
152+
149153
if ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT)
150154
!= (((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT))
151155
& opal_mem_hooks_support_level())) {
@@ -190,6 +194,9 @@ int opal_common_ofi_export_memory_monitor(void)
190194
free(opal_common_ofi_monitor);
191195
}
192196

197+
if (memory_base_frame_open) {
198+
mca_base_framework_close(&opal_memory_base_framework);
199+
}
193200
opal_common_ofi_installed_memory_monitor = false;
194201
}
195202

0 commit comments

Comments
 (0)