From e4db2c3ebb19998cf3b86fd055aedc6c7efee757 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Thu, 15 May 2014 15:59:51 +0000 Subject: [PATCH] ompi: fix various small leaks This commit fixes three leaks: - bml/r2: fix leak of del_procs in mca_bml_r2_del_procs - Release the modex data in btl/scif, btl/ugni, and btl/vader - ompi_mpi_finalize: close the allocator framework cmr=v1.8.2:reviewer=jsquyres This commit was SVN r31778. The following SVN revision numbers were found above: r2 --> open-mpi/ompi@58fdc188553052bc2e893ba28fb28fddbe78435a --- ompi/mca/bml/r2/bml_r2.c | 10 +++++++--- ompi/mca/btl/scif/btl_scif_endpoint.h | 5 +++++ ompi/mca/btl/vader/btl_vader_module.c | 2 ++ ompi/mca/common/ugni/common_ugni_ep.c | 2 ++ ompi/runtime/ompi_mpi_finalize.c | 3 +++ 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ompi/mca/bml/r2/bml_r2.c b/ompi/mca/bml/r2/bml_r2.c index 520cf7214d..483cb1a16a 100644 --- a/ompi/mca/bml/r2/bml_r2.c +++ b/ompi/mca/bml/r2/bml_r2.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology @@ -10,7 +10,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2007-2012 Los Alamos National Security, LLC. All rights + * Copyright (c) 2007-2014 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2013 Intel, Inc. All rights reserved @@ -208,7 +208,7 @@ static int mca_bml_r2_add_procs( size_t nprocs, /* for each proc that is reachable */ for( p = 0; p < n_new_procs; p++ ) { if(opal_bitmap_is_set_bit(reachable, p)) { - ompi_proc_t *proc = new_procs[p]; + ompi_proc_t *proc = new_procs[p]; mca_bml_base_endpoint_t * bml_endpoint = (mca_bml_base_endpoint_t*) proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML]; mca_bml_base_btl_t* bml_btl; @@ -469,6 +469,7 @@ static int mca_bml_r2_del_procs(size_t nprocs, rc = btl->btl_del_procs(btl,1,&proc,&bml_btl->btl_endpoint); if(OMPI_SUCCESS != rc) { + free(del_procs); return rc; } @@ -493,6 +494,7 @@ static int mca_bml_r2_del_procs(size_t nprocs, if (btl != 0) { rc = btl->btl_del_procs(btl,1,&proc,&bml_btl->btl_endpoint); if(OMPI_SUCCESS != rc) { + free(del_procs); return rc; } } @@ -503,6 +505,8 @@ static int mca_bml_r2_del_procs(size_t nprocs, OBJ_RELEASE(bml_endpoint); } + free(del_procs); + return OMPI_SUCCESS; } diff --git a/ompi/mca/btl/scif/btl_scif_endpoint.h b/ompi/mca/btl/scif/btl_scif_endpoint.h index 5ed35235eb..efb091eef6 100644 --- a/ompi/mca/btl/scif/btl_scif_endpoint.h +++ b/ompi/mca/btl/scif/btl_scif_endpoint.h @@ -78,6 +78,9 @@ static inline int mca_btl_scif_ep_init (mca_btl_base_endpoint_t *endpoint, rc = ompi_modex_recv (&mca_btl_scif_component.super.btl_version, peer_proc, (void **) &modex, &msg_size); + if (OMPI_SUCCESS != rc) { + return rc; + } assert (msg_size == sizeof (endpoint->port_id)); endpoint->port_id = modex->port_id; @@ -89,6 +92,8 @@ static inline int mca_btl_scif_ep_init (mca_btl_base_endpoint_t *endpoint, endpoint->seq_expected = 0x00001010; #endif + free (modex); + return OMPI_SUCCESS; } diff --git a/ompi/mca/btl/vader/btl_vader_module.c b/ompi/mca/btl/vader/btl_vader_module.c index 8410452d56..500c4e5244 100644 --- a/ompi/mca/btl/vader/btl_vader_module.c +++ b/ompi/mca/btl/vader/btl_vader_module.c @@ -192,6 +192,8 @@ static int init_vader_endpoint (struct mca_btl_base_endpoint_t *ep, struct ompi_ } #endif + free (modex); + ep->next_fbox_out = 0; ep->next_fbox_in = 0; ep->next_sequence = 0; diff --git a/ompi/mca/common/ugni/common_ugni_ep.c b/ompi/mca/common/ugni/common_ugni_ep.c index 3d54996f4e..28d210ac2f 100644 --- a/ompi/mca/common/ugni/common_ugni_ep.c +++ b/ompi/mca/common/ugni/common_ugni_ep.c @@ -45,6 +45,8 @@ int ompi_common_ugni_endpoint_for_proc (ompi_common_ugni_device_t *dev, ompi_pro *ep = endpoint; + free (modex); + return OMPI_SUCCESS; } diff --git a/ompi/runtime/ompi_mpi_finalize.c b/ompi/runtime/ompi_mpi_finalize.c index 1af32581ea..6311fae05e 100644 --- a/ompi/runtime/ompi_mpi_finalize.c +++ b/ompi/runtime/ompi_mpi_finalize.c @@ -411,6 +411,9 @@ int ompi_mpi_finalize(void) if (OMPI_SUCCESS != (ret = mca_base_framework_close(&ompi_rcache_base_framework))) { return ret; } + if (OMPI_SUCCESS != (ret = mca_base_framework_close(&ompi_allocator_base_framework))) { + return ret; + } if (NULL != ompi_mpi_main_thread) { OBJ_RELEASE(ompi_mpi_main_thread);