ompi/bcol: fix misc memory leaks
as reported by Coverity with CIDs 715758-715762,715765 and 715767
Этот коммит содержится в:
родитель
04a0438b56
Коммит
464dbccb7b
@ -5,7 +5,7 @@
|
||||
* Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2014 Research Organization for Information Science
|
||||
* Copyright (c) 2014-2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -159,6 +159,7 @@ static int mca_bcol_base_set_components_to_use(opal_list_t *bcol_components_avai
|
||||
/* found selected component */
|
||||
b_clj = OBJ_NEW(mca_base_component_list_item_t);
|
||||
if (NULL == b_clj) {
|
||||
opal_argv_free (bcols_requested);
|
||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
@ -285,9 +286,13 @@ int mca_bcol_base_set_attributes(struct mca_bcol_base_module_t *bcol_module,
|
||||
int coll_type;
|
||||
|
||||
comm_attribs = malloc(sizeof(mca_bcol_base_coll_fn_comm_attributes_t));
|
||||
if (NULL == comm_attribs) {
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
inv_attribs = malloc(sizeof(mca_bcol_base_coll_fn_invoke_attributes_t));
|
||||
|
||||
if (!((comm_attribs) && (inv_attribs))) {
|
||||
if (NULL == inv_attribs) {
|
||||
free(comm_attribs);
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
|
||||
* Copyright (c) 2013-2014 Los Alamos National Security, LLC.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2014 Research Organization for Information Science
|
||||
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -265,7 +265,7 @@ int bcol_basesmuma_bank_init_opti(struct mca_bcol_base_memory_block_desc_t *payl
|
||||
(mca_bcol_basesmuma_module_t *)bcol_module;
|
||||
int my_idx, array_id;
|
||||
mca_bcol_basesmuma_header_t *ctl_ptr;
|
||||
void **results_array, *mem_offset;
|
||||
void **results_array=NULL, *mem_offset;
|
||||
|
||||
mca_bcol_basesmuma_local_mlmem_desc_t *ml_mem = &sm_bcol_module->ml_mem;
|
||||
|
||||
@ -289,6 +289,10 @@ int bcol_basesmuma_bank_init_opti(struct mca_bcol_base_memory_block_desc_t *payl
|
||||
|
||||
/* allocate some memory to hold the offsets */
|
||||
results_array = (void **) malloc(pload_mgmt->size_of_group * sizeof (void *));
|
||||
if (NULL == results_array) {
|
||||
ret = OMPI_ERR_OUT_OF_RESOURCE;
|
||||
goto exit_ERROR;
|
||||
}
|
||||
|
||||
/* setup the input file for the shared memory connection manager */
|
||||
input_file.file_name = sm_reg_data->file_name;
|
||||
@ -371,6 +375,7 @@ int bcol_basesmuma_bank_init_opti(struct mca_bcol_base_memory_block_desc_t *payl
|
||||
|
||||
/* done with the index array */
|
||||
free (results_array);
|
||||
results_array = NULL;
|
||||
|
||||
/* initialize my control structures!! */
|
||||
my_idx = sm_bcol_module->super.sbgp_partner_module->my_index;
|
||||
@ -424,6 +429,9 @@ int bcol_basesmuma_bank_init_opti(struct mca_bcol_base_memory_block_desc_t *payl
|
||||
return OMPI_SUCCESS;
|
||||
|
||||
exit_ERROR:
|
||||
if (NULL != results_array) {
|
||||
free(results_array);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
|
||||
* Copyright (c) 2012-2014 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2014 Research Organization for Information Science
|
||||
* Copyright (c) 2014-2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -679,6 +679,7 @@ mca_bcol_basesmuma_comm_query(mca_sbgp_base_module_t *module, int *num_modules)
|
||||
free(sm_module->reduction_tree);
|
||||
sm_module->reduction_tree=NULL;
|
||||
}
|
||||
free(sm_modules);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Copyright (c) 2012-2014 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2014 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014 Research Organization for Information Science
|
||||
* Copyright (c) 2014-2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -379,11 +379,13 @@ bcol_basesmuma_smcm_mmap_t *bcol_basesmuma_smcm_mem_reg(void *in_ptr,
|
||||
rc = ftruncate (fd, length);
|
||||
if (0 > rc) {
|
||||
opal_output (ompi_bcol_base_framework.framework_output, "failed to truncate the file to be mapped. errno: %d", errno);
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
map = bcol_basesmuma_smcm_reg_mmap(in_ptr, fd, length, 0, alignment, file_name);
|
||||
if (NULL == map) {
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
|
||||
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2014 Research Organization for Information Science
|
||||
* Copyright (c) 2014-2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -754,5 +754,6 @@ mca_bcol_base_module_t **mca_bcol_ptpcoll_comm_query(mca_sbgp_base_module_t *sbg
|
||||
CLEANUP:
|
||||
|
||||
OBJ_RELEASE(ptpcoll_module);
|
||||
free(ptpcoll_modules);
|
||||
return NULL;
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user