From f5cd996b91b98c3725550fcad7f6a28123181b7f Mon Sep 17 00:00:00 2001
From: Ralph Castain <rhc@open-mpi.org>
Date: Mon, 9 Apr 2012 22:44:56 +0000
Subject: [PATCH] Fix the case where n=1

This commit was SVN r26258.
---
 orte/mca/grpcomm/bad/grpcomm_bad_module.c  | 7 +++++--
 orte/mca/grpcomm/base/grpcomm_base_modex.c | 5 +++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/orte/mca/grpcomm/bad/grpcomm_bad_module.c b/orte/mca/grpcomm/bad/grpcomm_bad_module.c
index 9d3ea66c62..2ef16adc77 100644
--- a/orte/mca/grpcomm/bad/grpcomm_bad_module.c
+++ b/orte/mca/grpcomm/bad/grpcomm_bad_module.c
@@ -211,8 +211,11 @@ static int bad_allgather(orte_grpcomm_collective_t *gather)
                          "%s grpcomm:bad entering allgather",
                          ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
     
-    /* if I am alone, just fire callback */
-    if (1 == orte_process_info.num_procs) {
+    /* if I am alone and nobody else is participating, then
+     * nothing really to do
+     */
+    if (1 == orte_process_info.num_procs &&
+        0 == opal_list_get_size(&gather->participants)) {
         gather->active = false;
         if (NULL != gather->cbfunc) {
             gather->cbfunc(&gather->buffer, gather->cbdata);
diff --git a/orte/mca/grpcomm/base/grpcomm_base_modex.c b/orte/mca/grpcomm/base/grpcomm_base_modex.c
index 987ddeb8ff..d46e673b4d 100644
--- a/orte/mca/grpcomm/base/grpcomm_base_modex.c
+++ b/orte/mca/grpcomm/base/grpcomm_base_modex.c
@@ -161,7 +161,6 @@ int orte_grpcomm_base_modex(orte_grpcomm_collective_t *modex)
     return ORTE_SUCCESS;
 
  cleanup:
-    OBJ_RELEASE(modex);
     return rc;
 }
 
@@ -372,7 +371,9 @@ void orte_grpcomm_base_store_peer_modex(opal_buffer_t *rbuf, void *cbdata)
  cleanup:
     /* flag the collective as complete */
     modex->active = false;
-    /* cleanup */
+    /* cleanup the list, but don't release the
+     * collective object as it was passed into us
+     */
     opal_list_remove_item(&orte_grpcomm_base.active_colls, &modex->super);
     /* notify that the modex is complete */
     if (NULL != modex->cbfunc) {