From df82e4cd3667d4aeb5f92d9a3f4bad847cfc86b5 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Sat, 12 Mar 2011 15:37:33 +0000 Subject: [PATCH] Plug a memory leak This commit was SVN r24521. --- orte/mca/rmaps/load_balance/rmaps_lb.c | 3 +++ orte/mca/rmaps/rank_file/rmaps_rank_file.c | 3 +++ orte/mca/rmaps/resilient/rmaps_resilient.c | 5 ++++- orte/mca/rmaps/round_robin/rmaps_rr.c | 3 +++ orte/mca/rmaps/seq/rmaps_seq.c | 3 +++ 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/orte/mca/rmaps/load_balance/rmaps_lb.c b/orte/mca/rmaps/load_balance/rmaps_lb.c index 2afb5e4fdf..226aca8c9a 100644 --- a/orte/mca/rmaps/load_balance/rmaps_lb.c +++ b/orte/mca/rmaps/load_balance/rmaps_lb.c @@ -79,6 +79,9 @@ static int switchyard(orte_job_t *jdata) ORTE_JOBID_PRINT(jdata->jobid)); /* flag that I did the mapping */ + if (NULL != jdata->map->last_mapper) { + free(jdata->map->last_mapper); + } jdata->map->last_mapper = strdup(c->mca_component_name); if (0 < mca_rmaps_load_balance_component.npernode || diff --git a/orte/mca/rmaps/rank_file/rmaps_rank_file.c b/orte/mca/rmaps/rank_file/rmaps_rank_file.c index 6670ebb0b2..c3fab74570 100644 --- a/orte/mca/rmaps/rank_file/rmaps_rank_file.c +++ b/orte/mca/rmaps/rank_file/rmaps_rank_file.c @@ -316,6 +316,9 @@ static int orte_rmaps_rf_map(orte_job_t *jdata) ORTE_JOBID_PRINT(jdata->jobid)); /* flag that I did the mapping */ + if (NULL != jdata->map->last_mapper) { + free(jdata->map->last_mapper); + } jdata->map->last_mapper = strdup(c->mca_component_name); /* convenience def */ diff --git a/orte/mca/rmaps/resilient/rmaps_resilient.c b/orte/mca/rmaps/resilient/rmaps_resilient.c index e1e0128551..57b4474f16 100644 --- a/orte/mca/rmaps/resilient/rmaps_resilient.c +++ b/orte/mca/rmaps/resilient/rmaps_resilient.c @@ -75,7 +75,7 @@ static int orte_rmaps_resilient_map(orte_job_t *jdata) 0 != strcasecmp(jdata->map->req_mapper, c->mca_component_name)) { /* a mapper has been specified, and it isn't me */ opal_output_verbose(5, orte_rmaps_base.rmaps_output, - "mca:rmaps:resilient: job %s not using loadbalance mapper", + "mca:rmaps:resilient: job %s not using resilient mapper", ORTE_JOBID_PRINT(jdata->jobid)); return ORTE_ERR_TAKE_NEXT_OPTION; } @@ -98,6 +98,9 @@ static int orte_rmaps_resilient_map(orte_job_t *jdata) ORTE_JOBID_PRINT(jdata->jobid)); /* flag that I did the mapping */ + if (NULL != jdata->map->last_mapper) { + free(jdata->map->last_mapper); + } jdata->map->last_mapper = strdup(c->mca_component_name); /* have we already constructed the fault group list? */ diff --git a/orte/mca/rmaps/round_robin/rmaps_rr.c b/orte/mca/rmaps/round_robin/rmaps_rr.c index 3a68994570..3d92080d3d 100644 --- a/orte/mca/rmaps/round_robin/rmaps_rr.c +++ b/orte/mca/rmaps/round_robin/rmaps_rr.c @@ -89,6 +89,9 @@ static int orte_rmaps_rr_map(orte_job_t *jdata) ORTE_JOBID_PRINT(jdata->jobid)); /* flag that I did the mapping */ + if (NULL != jdata->map->last_mapper) { + free(jdata->map->last_mapper); + } jdata->map->last_mapper = strdup(c->mca_component_name); /* start at the beginning... */ diff --git a/orte/mca/rmaps/seq/rmaps_seq.c b/orte/mca/rmaps/seq/rmaps_seq.c index 0462aa540e..f65de806c1 100644 --- a/orte/mca/rmaps/seq/rmaps_seq.c +++ b/orte/mca/rmaps/seq/rmaps_seq.c @@ -110,6 +110,9 @@ static int orte_rmaps_seq_map(orte_job_t *jdata) ORTE_JOBID_PRINT(jdata->jobid)); /* flag that I did the mapping */ + if (NULL != jdata->map->last_mapper) { + free(jdata->map->last_mapper); + } jdata->map->last_mapper = strdup(c->mca_component_name); /* conveniece def */