1
1

ess/hnp: plug a memory leak in rte_finalize()

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>

(cherry picked from commit open-mpi/ompi@d234caef74)
Этот коммит содержится в:
Gilles Gouaillardet 2018-05-21 13:33:27 +09:00
родитель d2646cd565
Коммит 959aeab5d9

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

@ -859,6 +859,52 @@ static int rte_finalize(void)
if (orte_do_not_launch) {
exit(0);
}
{
opal_pointer_array_t * array = orte_node_topologies;
int i;
if( array->number_free != array->size ) {
OPAL_THREAD_LOCK(&array->lock);
array->lowest_free = 0;
array->number_free = array->size;
for(i=0; i<array->size; i++) {
if(NULL != array->addr[i]) {
orte_topology_t * topo = (orte_topology_t *)array->addr[i];
topo->topo = NULL;
OBJ_RELEASE(topo);
}
array->addr[i] = NULL;
}
OPAL_THREAD_UNLOCK(&array->lock);
}
}
OBJ_RELEASE(orte_node_topologies);
{
opal_pointer_array_t * array = orte_node_pool;
int i;
orte_node_t* node = (orte_node_t *)opal_pointer_array_get_item(orte_node_pool, 0);
assert(NULL != node);
OBJ_RELEASE(node->daemon);
node->daemon = NULL;
if( array->number_free != array->size ) {
OPAL_THREAD_LOCK(&array->lock);
array->lowest_free = 0;
array->number_free = array->size;
for(i=0; i<array->size; i++) {
if(NULL != array->addr[i]) {
node= (orte_node_t*)array->addr[i];
OBJ_RELEASE(node);
}
array->addr[i] = NULL;
}
OPAL_THREAD_UNLOCK(&array->lock);
}
}
OBJ_RELEASE(orte_node_pool);
free(orte_topo_signature);
return ORTE_SUCCESS;
}