Skip to content

Commit 2457171

Browse files
committed
Fix segv when io component can't be opened.
Hold off on initializing these until we're sure the component can be opened, otherwise it will segv on a NULL, uninitialized comm in the destructor instead of returning gracefully. Signed-off-by: Austen Lauria <awlauria@us.ibm.com>
1 parent 722f7a3 commit 2457171

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

ompi/mca/io/base/io_base_file_select.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,8 @@ int mca_io_base_file_select(ompi_file_t *file,
192192
unquery(avail, file);
193193
OBJ_RELEASE(item);
194194
}
195-
OBJ_RELEASE(selectable);
196-
197-
/* Save the pointers of the selected module on the ompi_file_t */
198195

199-
file->f_io_version = selected.ai_version;
200-
file->f_io_selected_component = selected.ai_component;
201-
file->f_io_selected_module = selected.ai_module;
202-
file->f_io_selected_data = selected.ai_module_data;
196+
OBJ_RELEASE(selectable);
203197

204198
if (!strcmp (selected.ai_component.v2_0_0.io_version.mca_component_name,
205199
"ompio")) {
@@ -242,6 +236,14 @@ int mca_io_base_file_select(ompi_file_t *file,
242236
}
243237

244238
}
239+
240+
/* Save the pointers of the selected module on the ompi_file_t */
241+
242+
file->f_io_version = selected.ai_version;
243+
file->f_io_selected_component = selected.ai_component;
244+
file->f_io_selected_module = selected.ai_module;
245+
file->f_io_selected_data = selected.ai_module_data;
246+
245247
/* Finally -- intialize the selected module. */
246248

247249
if (OMPI_SUCCESS != (err = module_init(file))) {

0 commit comments

Comments
 (0)