1
1

First part of memory leak cleanups from Gilles

Этот коммит содержится в:
Ralph Castain 2014-11-24 16:53:33 -08:00
родитель ee3d1ed5fd
Коммит 48f702827e
5 изменённых файлов: 35 добавлений и 4 удалений

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

@ -584,6 +584,9 @@ static int connect_accept(ompi_communicator_t *comm, int root,
if ( NULL != proc_list ) {
free ( proc_list );
}
if ( NULL != new_proc_list ) {
free ( new_proc_list );
}
if ( OMPI_SUCCESS != rc ) {
if ( MPI_COMM_NULL != newcomp && NULL != newcomp ) {
OBJ_RETAIN(newcomp);

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

@ -312,13 +312,14 @@ static void xcast_recv(int status, orte_process_name_t* sender,
rly = OBJ_NEW(opal_buffer_t);
opal_dss.copy_payload(rly, buffer);
/* get the signature */
/* get the signature that we do not need */
cnt=1;
if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &sig, &cnt, ORTE_SIGNATURE))) {
ORTE_ERROR_LOG(ret);
ORTE_FORCED_TERMINATE(ret);
return;
}
OBJ_RELEASE(sig);
/* get the target tag */
cnt=1;

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

@ -15,6 +15,8 @@
* All rights reserved.
* Copyright (c) 2011-2013 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013-2014 Intel, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -393,7 +395,16 @@ static int odls_base_default_setup_fork(orte_job_t *jdata,
/* setup base environment: copy the current environ and merge
in the app context environ */
if (NULL != context->env) {
*environ_copy = opal_environ_merge(orte_launch_environ, context->env);
if (*environ_copy == context->env) {
/* manually free original context->env to avoid a memory leak */
char ** tmp = context->env;
*environ_copy = opal_environ_merge(orte_launch_environ, context->env);
if (NULL != tmp) {
opal_argv_free(tmp);
}
} else {
*environ_copy = opal_environ_merge(orte_launch_environ, context->env);
}
} else {
*environ_copy = opal_argv_copy(orte_launch_environ);
}
@ -891,8 +902,8 @@ void orte_odls_base_default_launch_local(int fd, short sd, void *cbdata)
orte_jobid_t job = caddy->job;
orte_odls_base_fork_local_proc_fn_t fork_local = caddy->fork_local;
char *num_app_ctx = NULL;
char **nps, *npstring;
char **firstranks, *firstrankstring;
char **nps, *npstring = NULL;
char **firstranks, *firstrankstring = NULL;
bool index_argv;
/* establish our baseline working directory - we will be potentially
@ -1385,6 +1396,16 @@ void orte_odls_base_default_launch_local(int fd, short sd, void *cbdata)
ERROR_OUT:
/* ensure we reset our working directory back to our default location */
chdir(basedir);
/* release allocated memory */
if (NULL != num_app_ctx) {
free(num_app_ctx);
}
if (NULL != npstring) {
free(npstring);
}
if (NULL != firstrankstring) {
free(firstrankstring);
}
/* release the event */
OBJ_RELEASE(caddy);
}

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

@ -14,6 +14,8 @@
* et Automatique. All rights reserved.
* Copyright (c) 2011-2012 Los Alamos National Security, LLC.
* Copyright (c) 2013-2014 Intel, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -521,6 +523,7 @@ void orte_plm_base_launch_apps(int fd, short args, void *cbdata)
OBJ_RELEASE(caddy);
return;
}
OBJ_RELEASE(buffer);
/* maintain accounting */
OBJ_RELEASE(sig);

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

@ -12,6 +12,8 @@
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2008-2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -140,6 +142,7 @@ int orte_util_check_context_app(orte_app_context_t *context, char **env)
if (NULL != context->app) free(context->app);
context->app = tmp;
} else {
free(tmp);
if (0 != access(context->app, X_OK)) {
return ORTE_ERR_EXE_NOT_ACCESSIBLE;
}