Skip to content

Commit af67183

Browse files
committed
pml/v: fix a memory leak
close the framework if no more component should be used Signed-off-by: Gilles Gouaillardet <[email protected]>
1 parent ef2b3ac commit af67183

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

ompi/mca/pml/v/pml_v_component.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
66
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
77
* reserved.
8+
* Copyright (c) 2016 Research Organization for Information Science
9+
* and Technology (RIST). All rights reserved.
810
* $COPYRIGHT$
911
*
1012
* Additional copyrights may follow
@@ -97,13 +99,23 @@ static int mca_pml_v_component_register(void)
9799

98100
static int mca_pml_v_component_open(void)
99101
{
102+
int rc;
100103
pml_v_output_open(ompi_pml_v_output, ompi_pml_v_verbose);
101104

102105
V_OUTPUT_VERBOSE(500, "loaded");
103106

104107
mca_vprotocol_base_set_include_list(ompi_pml_vprotocol_include_list);
105108

106-
return mca_base_framework_open(&ompi_vprotocol_base_framework, 0);
109+
if (OMPI_SUCCESS != (rc = mca_base_framework_open(&ompi_vprotocol_base_framework, 0))) {
110+
return rc;
111+
}
112+
113+
if( NULL == mca_vprotocol_base_include_list ) {
114+
pml_v_output_close();
115+
return mca_base_framework_close(&ompi_vprotocol_base_framework);
116+
}
117+
118+
return rc;
107119
}
108120

109121
static int mca_pml_v_component_close(void)

0 commit comments

Comments
 (0)