Skip to content

Commit 4bbad5e

Browse files
committed
fix some memleak
avx_component module retain twice by avx_component_op_query and ompi_op_base_op_select function; mca_base_var_register will strdup, and not free old string; opal_patcher_base_framework not close; Signed-off-by: wjjahah <2457791952@qq.com>
1 parent c859bfe commit 4bbad5e

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

ompi/mca/op/avx/op_avx_component.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -298,12 +298,6 @@ avx_component_op_query(struct ompi_op_t *op, int *priority)
298298
}
299299
}
300300
#endif
301-
if( NULL != module->opm_fns[i] ) {
302-
OBJ_RETAIN(module);
303-
}
304-
if( NULL != module->opm_3buff_fns[i] ) {
305-
OBJ_RETAIN(module);
306-
}
307301
}
308302
break;
309303
case OMPI_OP_BASE_FORTRAN_LAND:

opal/mca/common/ucx/common_ucx.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ OPAL_DECLSPEC void opal_common_ucx_mca_var_register(const mca_base_component_t *
7373
{
7474
char *default_tls = "rc_verbs,ud_verbs,rc_mlx5,dc_mlx5,ud_mlx5,cuda_ipc,rocm_ipc";
7575
char *default_devices = "mlx*";
76+
char *old_str = NULL;
7677
int hook_index;
7778
int verbose_index;
7879
int progress_index;
@@ -113,6 +114,7 @@ OPAL_DECLSPEC void opal_common_ucx_mca_var_register(const mca_base_component_t *
113114
if (NULL == *opal_common_ucx.tls) {
114115
*opal_common_ucx.tls = strdup(default_tls);
115116
}
117+
old_str = *opal_common_ucx.tls;
116118

117119
tls_index = mca_base_var_register(
118120
"opal", "opal_common", "ucx", "tls",
@@ -123,6 +125,7 @@ OPAL_DECLSPEC void opal_common_ucx_mca_var_register(const mca_base_component_t *
123125
"please set to '^posix,sysv,self,tcp,cma,knem,xpmem'.",
124126
MCA_BASE_VAR_TYPE_STRING, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE | MCA_BASE_VAR_FLAG_DWG,
125127
OPAL_INFO_LVL_3, MCA_BASE_VAR_SCOPE_LOCAL, opal_common_ucx.tls);
128+
free(old_str);
126129

127130
if (NULL == opal_common_ucx.devices) {
128131
opal_common_ucx.devices = (char**) malloc(sizeof(char*));
@@ -132,13 +135,15 @@ OPAL_DECLSPEC void opal_common_ucx_mca_var_register(const mca_base_component_t *
132135
if (NULL == *opal_common_ucx.devices) {
133136
*opal_common_ucx.devices = strdup(default_devices);
134137
}
138+
old_str = *opal_common_ucx.devices;
135139

136140
devices_index = mca_base_var_register(
137141
"opal", "opal_common", "ucx", "devices",
138142
"List of device driver pattern names, which, if supported by UCX, will "
139143
"bump its priority above ob1. Special values: any (any available)",
140144
MCA_BASE_VAR_TYPE_STRING, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE | MCA_BASE_VAR_FLAG_DWG,
141145
OPAL_INFO_LVL_3, MCA_BASE_VAR_SCOPE_LOCAL, opal_common_ucx.devices);
146+
free(old_str);
142147

143148
if (component) {
144149
mca_base_var_register_synonym(verbose_index, component->mca_project_name,

opal/mca/patcher/base/patcher_base_frame.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static int opal_patcher_base_close(void)
9090
return opal_patcher->patch_fini();
9191
}
9292

93-
return OPAL_SUCCESS;
93+
return mca_base_framework_components_close(&opal_patcher_base_framework, NULL);
9494
}
9595

9696
/* Use default register/open functions */

0 commit comments

Comments
 (0)