From a9044945fe4cedbcacd3415a2136aea470dade43 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Mon, 9 Mar 2015 14:34:28 +0900 Subject: [PATCH] ompi/proc: correctly handle cutoff modex case as reported by Coverity with CID 1196664 --- ompi/proc/proc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ompi/proc/proc.c b/ompi/proc/proc.c index 06566ade97..701fb4f7d1 100644 --- a/ompi/proc/proc.c +++ b/ompi/proc/proc.c @@ -762,12 +762,14 @@ ompi_proc_unpack(opal_buffer_t* buf, #endif } - if (0 == strcmp(ompi_proc_local_proc->super.proc_hostname, new_hostname)) { - plist[i]->super.proc_flags |= (OPAL_PROC_ON_NODE | OPAL_PROC_ON_CU | OPAL_PROC_ON_CLUSTER); - } + if (NULL != new_hostname) { + if (0 == strcmp(ompi_proc_local_proc->super.proc_hostname, new_hostname)) { + plist[i]->super.proc_flags |= (OPAL_PROC_ON_NODE | OPAL_PROC_ON_CU | OPAL_PROC_ON_CLUSTER); + } - /* Save the hostname */ - plist[i]->super.proc_hostname = new_hostname; + /* Save the hostname */ + plist[i]->super.proc_hostname = new_hostname; + } } else { if (full_info) {