Skip to content

Commit 3c5c132

Browse files
committed
Don't pass immutable string to PMIx_Get_attribute_string taking char*
Signed-off-by: Joseph Schuchart <[email protected]>
1 parent 40ac165 commit 3c5c132

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
@@ -714,7 +714,10 @@ static int dpm_convert(opal_list_t *infos,
714714
if (0 != strncasecmp(ck, directive, strlen(directive))) {
715715
opal_asprintf(&help_str, "Conflicting directives \"%s %s\"", ck, directive);
716716
#if PMIX_NUMERIC_VERSION >= 0x00040000
717-
attr = PMIx_Get_attribute_string(option);
717+
/* TODO: remove strdup if PMIx_Get_attribute_string takes const char* */
718+
char *option_dup = strdup(option);
719+
attr = PMIx_Get_attribute_string(option_dup);
720+
free(option_dup);
718721
#else
719722
attr = option;
720723
#endif
@@ -745,8 +748,10 @@ static int dpm_convert(opal_list_t *infos,
745748
/* we have a conflict */
746749
opal_asprintf(&ptr, " Option %s\n Conflicting modifiers \"%s %s\"", option, infokey, modifier);
747750
#if PMIX_NUMERIC_VERSION >= 0x00040000
748-
/* TODO: this triggers a const warning :/ */
749-
attr = PMIx_Get_attribute_string(option);
751+
/* TODO: remove strdup if PMIx_Get_attribute_string takes const char* */
752+
char *option_dup = strdup(option);
753+
attr = PMIx_Get_attribute_string(option_dup);
754+
free(option_dup);
750755
#else
751756
attr = option;
752757
#endif

0 commit comments

Comments
 (0)