Skip to content

Commit 8fddcb8

Browse files
committed
Don't pass immutable string to PMIx_Get_attribute_string taking char*
Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
1 parent a7d3ae9 commit 8fddcb8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

ompi/dpm/dpm.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,10 @@ static int dpm_convert(opal_list_t *infos,
684684
if (0 != strncasecmp(ck, directive, strlen(directive))) {
685685
opal_asprintf(&help_str, "Conflicting directives \"%s %s\"", ck, directive);
686686
#if PMIX_NUMERIC_VERSION >= 0x00040000
687-
attr = PMIx_Get_attribute_string(option);
687+
/* TODO: remove strdup if PMIx_Get_attribute_string takes const char* */
688+
char *option_dup = strdup(option);
689+
attr = PMIx_Get_attribute_string(option_dup);
690+
free(option_dup);
688691
#else
689692
attr = option;
690693
#endif
@@ -715,8 +718,10 @@ static int dpm_convert(opal_list_t *infos,
715718
/* we have a conflict */
716719
opal_asprintf(&ptr, " Option %s\n Conflicting modifiers \"%s %s\"", option, infokey, modifier);
717720
#if PMIX_NUMERIC_VERSION >= 0x00040000
718-
/* TODO: this triggers a const warning :/ */
719-
attr = PMIx_Get_attribute_string(option);
721+
/* TODO: remove strdup if PMIx_Get_attribute_string takes const char* */
722+
char *option_dup = strdup(option);
723+
attr = PMIx_Get_attribute_string(option_dup);
724+
free(option_dup);
720725
#else
721726
attr = option;
722727
#endif

0 commit comments

Comments
 (0)