Skip to content

Commit 6ab6775

Browse files
authored
Merge pull request #12242 from hppritcha/fix_for_pr_11854
fix a bug introduced by PR 11854
2 parents ccb28c9 + 86a05c1 commit 6ab6775

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

opal/mca/pmix/base/pmix_base_fns.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static bool check_pmix_overlap(char *var, char *value)
142142
// changes here, there are likely to be changes there.
143143
static void translate_params(void)
144144
{
145-
char *evar, *tmp, *e2;
145+
char *evar = NULL, *tmp, *e2 = NULL;
146146
char *file;
147147
const char *home;
148148
opal_list_t params;
@@ -193,20 +193,22 @@ static void translate_params(void)
193193
home = opal_home_directory();
194194
if (NULL != home) {
195195
file = opal_os_path(false, home, ".openmpi", "mca-params.conf", NULL);
196-
OBJ_CONSTRUCT(&params, opal_list_t);
197-
mca_base_parse_paramfile(file, &params);
198-
free(file);
199-
OPAL_LIST_FOREACH (fv, &params, mca_base_var_file_value_t) {
200-
pmix_overlap = check_pmix_overlap(&e2[len], evar);
201-
if (!pmix_overlap && check_pmix_param(fv->mbvfv_var)) {
202-
opal_asprintf(&tmp, "PMIX_MCA_%s", fv->mbvfv_var);
203-
// set it, but don't overwrite if they already
204-
// have a value in our environment
205-
setenv(tmp, fv->mbvfv_value, false);
206-
free(tmp);
196+
if (NULL != file) {
197+
OBJ_CONSTRUCT(&params, opal_list_t);
198+
mca_base_parse_paramfile(file, &params);
199+
free(file);
200+
OPAL_LIST_FOREACH (fv, &params, mca_base_var_file_value_t) {
201+
pmix_overlap = check_pmix_overlap(fv->mbvfv_var, fv->mbvfv_value);
202+
if (!pmix_overlap && check_pmix_param(fv->mbvfv_var)) {
203+
opal_asprintf(&tmp, "PMIX_MCA_%s", fv->mbvfv_var);
204+
// set it, but don't overwrite if they already
205+
// have a value in our environment
206+
setenv(tmp, fv->mbvfv_value, false);
207+
free(tmp);
208+
}
207209
}
210+
OPAL_LIST_DESTRUCT(&params);
208211
}
209-
OPAL_LIST_DESTRUCT(&params);
210212
}
211213

212214
/* check if the user has set OMPIHOME in their environment */

0 commit comments

Comments
 (0)