1
1

orte/orted: plug misc memory leaks

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
Этот коммит содержится в:
Gilles Gouaillardet 2016-11-24 13:28:10 +09:00
родитель 88535b6200
Коммит c4a47ae9a9

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

@ -15,7 +15,7 @@
* Copyright (c) 2007-2016 Los Alamos National Security, LLC. All rights * Copyright (c) 2007-2016 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved. * Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2015-2016 Research Organization for Information Science * Copyright (c) 2015-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
@ -55,6 +55,7 @@
#ifdef HAVE_SYS_STAT_H #ifdef HAVE_SYS_STAT_H
#include <sys/stat.h> #include <sys/stat.h>
#endif #endif
#include <poll.h>
#include "opal/dss/dss.h" #include "opal/dss/dss.h"
#include "opal/mca/event/event.h" #include "opal/mca/event/event.h"
@ -612,6 +613,10 @@ void orte_submit_finalize(void)
close(orte_debugger_attach_fd); close(orte_debugger_attach_fd);
unlink(MPIR_attach_fifo); unlink(MPIR_attach_fifo);
} }
if (NULL != orte_cmd_options.prefix) {
free(orte_cmd_options.prefix);
}
} }
int orte_submit_cancel(int index) { int orte_submit_cancel(int index) {
@ -703,6 +708,9 @@ int orte_submit_job(char *argv[], int *index,
/* reset the globals every time thru as the argv /* reset the globals every time thru as the argv
* will modify them */ * will modify them */
if (NULL != orte_cmd_options.prefix) {
free(orte_cmd_options.prefix);
}
memset(&orte_cmd_options, 0, sizeof(orte_cmd_options)); memset(&orte_cmd_options, 0, sizeof(orte_cmd_options));
argc = opal_argv_count(argv); argc = opal_argv_count(argv);
@ -1282,12 +1290,18 @@ static int parse_locals(orte_job_t *jdata, int argc, char* argv[])
* region. * region.
* So we make a copy of the variable. * So we make a copy of the variable.
*/ */
char *s = strdup(env[j]); char *value, *s = strdup(env[j]);
if (NULL == s) { if (NULL == s) {
return OPAL_ERR_OUT_OF_RESOURCE; return OPAL_ERR_OUT_OF_RESOURCE;
} }
putenv(s);
value = strchr(s, '=');
if (NULL != value) {
value++;
}
opal_setenv(s, value, true, &environ);
free(s);
} }
} }