Skip to content

Commit 866f449

Browse files
committed
orte_dt_print_node: correctly handle nodes with no alias(es)
Thanks Erico for reporting this issue Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
1 parent d4fb877 commit 866f449

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

orte/runtime/data_type_support/orte_dt_print_fns.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* Copyright (c) 2011-2013 Los Alamos National Security, LLC.
1515
* All rights reserved.
1616
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
17+
* Copyright (c) 2018 Research Organization for Information Science
18+
* and Technology (RIST). All rights reserved.
1719
* $COPYRIGHT$
1820
*
1921
* Additional copyrights may follow
@@ -310,12 +312,14 @@ int orte_dt_print_node(char **output, char *prefix, orte_node_t *src, opal_data_
310312
tmp3 = NULL;
311313
if (orte_get_attribute(&src->attributes, ORTE_NODE_ALIAS, (void**)&tmp3, OPAL_STRING)) {
312314
alias = opal_argv_split(tmp3, ',');
313-
for (i=0; NULL != alias[i]; i++) {
314-
asprintf(&tmp2, "%s%s\tresolved from %s\n", tmp, pfx2, alias[i]);
315-
free(tmp);
316-
tmp = tmp2;
315+
if (NULL != alias) {
316+
for (i=0; NULL != alias[i]; i++) {
317+
asprintf(&tmp2, "%s%s\tresolved from %s\n", tmp, pfx2, alias[i]);
318+
free(tmp);
319+
tmp = tmp2;
320+
}
321+
opal_argv_free(alias);
317322
}
318-
opal_argv_free(alias);
319323
}
320324
if (NULL != tmp3) {
321325
free(tmp3);
@@ -331,12 +335,14 @@ int orte_dt_print_node(char **output, char *prefix, orte_node_t *src, opal_data_
331335
tmp3 = NULL;
332336
if (orte_get_attribute(&src->attributes, ORTE_NODE_ALIAS, (void**)&tmp3, OPAL_STRING)) {
333337
alias = opal_argv_split(tmp3, ',');
334-
for (i=0; NULL != alias[i]; i++) {
335-
asprintf(&tmp2, "%s%s\tresolved from %s\n", tmp, pfx2, alias[i]);
336-
free(tmp);
337-
tmp = tmp2;
338+
if (NULL != alias) {
339+
for (i=0; NULL != alias[i]; i++) {
340+
asprintf(&tmp2, "%s%s\tresolved from %s\n", tmp, pfx2, alias[i]);
341+
free(tmp);
342+
tmp = tmp2;
343+
}
344+
opal_argv_free(alias);
338345
}
339-
opal_argv_free(alias);
340346
}
341347
if (NULL != tmp3) {
342348
free(tmp3);

0 commit comments

Comments
 (0)