From 50b37758d4a41a4322fee0d7d9cdf1924c8f42de Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Thu, 19 May 2016 10:35:23 -0400 Subject: [PATCH] Don't overwrite the function argument. In a MPMD setup the app in the jdata can be NULL, so make sure we don't leave the main argument to an inconsistent value. --- orte/mca/schizo/ompi/schizo_ompi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/orte/mca/schizo/ompi/schizo_ompi.c b/orte/mca/schizo/ompi/schizo_ompi.c index 02374ebd3a..296cdfaa3b 100644 --- a/orte/mca/schizo/ompi/schizo_ompi.c +++ b/orte/mca/schizo/ompi/schizo_ompi.c @@ -733,6 +733,7 @@ static int setup_fork(orte_job_t *jdata, char *npstring, *firstrankstring; char *num_app_ctx; bool takeus = false; + orte_app_context_t* tmp_app; opal_output_verbose(1, orte_schizo_base_framework.framework_output, "%s schizo:ompi: setup_fork", @@ -941,11 +942,11 @@ static int setup_fork(orte_job_t *jdata, nps = NULL; firstranks = NULL; for (i=0; i < jdata->apps->size; i++) { - if (NULL == (app = (orte_app_context_t*)opal_pointer_array_get_item(jdata->apps, i))) { + if (NULL == (tmp_app = (orte_app_context_t*)opal_pointer_array_get_item(jdata->apps, i))) { continue; } - opal_argv_append_nosize(&nps, ORTE_VPID_PRINT(app->num_procs)); - opal_argv_append_nosize(&firstranks, ORTE_VPID_PRINT(app->first_rank)); + opal_argv_append_nosize(&nps, ORTE_VPID_PRINT(tmp_app->num_procs)); + opal_argv_append_nosize(&firstranks, ORTE_VPID_PRINT(tmp_app->first_rank)); } npstring = opal_argv_join(nps, ' '); firstrankstring = opal_argv_join(firstranks, ' ');