From 1766442591b4d680dff2a93e4b4d4ffb623700b8 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Thu, 1 May 2008 14:49:56 +0000 Subject: [PATCH] Fix a double-free when tree-spawning Fix the round-robin mapper so it doesn't move to the next node just because it completed mapping an app_context This commit was SVN r18344. --- orte/mca/plm/rsh/plm_rsh_module.c | 3 +-- orte/mca/rmaps/round_robin/rmaps_rr.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/orte/mca/plm/rsh/plm_rsh_module.c b/orte/mca/plm/rsh/plm_rsh_module.c index 03060e06f7..b3ed48859d 100644 --- a/orte/mca/plm/rsh/plm_rsh_module.c +++ b/orte/mca/plm/rsh/plm_rsh_module.c @@ -764,12 +764,11 @@ static int construct_daemonmap(opal_buffer_t *data) ORTE_ERROR_LOG(rc); return rc; } - /* unpack the nodemap */ + /* unpack the nodemap - this will free the bytes in bo */ if (ORTE_SUCCESS != (rc = orte_util_decode_nodemap(bo, &orte_daemonmap))) { ORTE_ERROR_LOG(rc); return rc; } - free(bo->bytes); return ORTE_SUCCESS; } diff --git a/orte/mca/rmaps/round_robin/rmaps_rr.c b/orte/mca/rmaps/round_robin/rmaps_rr.c index d4252292db..61f35101a1 100644 --- a/orte/mca/rmaps/round_robin/rmaps_rr.c +++ b/orte/mca/rmaps/round_robin/rmaps_rr.c @@ -229,11 +229,15 @@ static int map_app_by_slot( /* Update the number of procs allocated */ ++num_alloc; - /** if all the procs have been mapped OR we have fully used up this node + /** if all the procs have been mapped, we return */ + if (num_alloc == app->num_procs) { + return ORTE_SUCCESS; + } + + /* if we have fully used up this node * OR we are at our ppn and loadbalancing, then break from the loop */ - if (num_alloc == app->num_procs || - ORTE_ERR_NODE_FULLY_USED == rc || + if (ORTE_ERR_NODE_FULLY_USED == rc || (orte_rmaps_base.loadbalance && i == ppn)) { break; } @@ -246,7 +250,7 @@ static int map_app_by_slot( */ if (i < (num_slots_to_take-1) && ORTE_ERR_NODE_FULLY_USED != rc && - i != ppn) { + (orte_rmaps_base.loadbalance && i != ppn)) { continue; } cur_node_item = next;