1
1

ompi/proc: plug a memory leak in ompi_proc_finalize()

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
Этот коммит содержится в:
Gilles Gouaillardet 2017-01-06 13:09:28 +09:00
родитель 6d5cb9fe0d
Коммит cf534d0c95

Просмотреть файл

@ -14,7 +14,7 @@
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved
* Copyright (c) 2014-2016 Research Organization for Information Science
* Copyright (c) 2014-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Mellanox Technologies. All rights reserved.
*
@ -43,6 +43,7 @@
#include "ompi/datatype/ompi_datatype.h"
#include "ompi/runtime/mpiruntime.h"
#include "ompi/runtime/params.h"
#include "ompi/mca/pml/pml.h"
opal_list_t ompi_proc_list = {{0}};
static opal_mutex_t ompi_proc_lock;
@ -374,7 +375,7 @@ int ompi_proc_complete_init(void)
int ompi_proc_finalize (void)
{
opal_list_item_t *item;
ompi_proc_t *proc;
/* Unregister the local proc from OPAL */
opal_proc_local_set(NULL);
@ -398,8 +399,11 @@ int ompi_proc_finalize (void)
* it is thread safe to do so...though it may not -appear- to be so
* without walking through the entire list/destructor sequence.
*/
while (opal_list_get_end(&ompi_proc_list) != (item = opal_list_get_first(&ompi_proc_list))) {
OBJ_RELEASE(item);
while ((ompi_proc_t *)opal_list_get_end(&ompi_proc_list) != (proc = (ompi_proc_t *)opal_list_get_first(&ompi_proc_list))) {
if (NULL != proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML]) {
MCA_PML_CALL(del_procs(&proc, 1));
}
OBJ_RELEASE(proc);
}
/* now destruct the list and thread lock */
OBJ_DESTRUCT(&ompi_proc_list);
@ -703,7 +707,6 @@ ompi_proc_find_and_add(const ompi_process_name_t * name, bool* isnew)
*/
if (NULL == rproc) {
*isnew = true;
rproc = OBJ_NEW(ompi_proc_t);
ompi_proc_allocate (name->jobid, name->vpid, &rproc);
}