orte/tools: fix misc memory leaks
as reported by Coverity with CIDs 70700, 71039, 71854, 72384 and 710651
Этот коммит содержится в:
родитель
d1b2f043ff
Коммит
4e7b5240e4
@ -13,6 +13,8 @@
|
|||||||
* Copyright (c) 2007-2013 Los Alamos National Security, LLC. All rights
|
* Copyright (c) 2007-2013 Los Alamos National Security, LLC. All rights
|
||||||
* reserved.
|
* reserved.
|
||||||
* Copyright (c) 2011-2013 Cisco Systems, Inc. All rights reserved.
|
* Copyright (c) 2011-2013 Cisco Systems, Inc. All rights reserved.
|
||||||
|
* Copyright (c) 2015 Research Organization for Information Science
|
||||||
|
* and Technology (RIST). All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -351,6 +353,7 @@ void kill_procs(void) {
|
|||||||
*/
|
*/
|
||||||
if (NULL == (inputline = orte_getline(psfile))) {
|
if (NULL == (inputline = orte_getline(psfile))) {
|
||||||
free(this_user);
|
free(this_user);
|
||||||
|
fclose(psfile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
free(inputline); /* dump the header line */
|
free(inputline); /* dump the header line */
|
||||||
@ -441,5 +444,6 @@ void kill_procs(void) {
|
|||||||
free(procname);
|
free(procname);
|
||||||
}
|
}
|
||||||
free(this_user);
|
free(this_user);
|
||||||
|
fclose(psfile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1094,7 +1094,7 @@ static int create_app(int argc, char* argv[],
|
|||||||
}
|
}
|
||||||
free(value);
|
free(value);
|
||||||
} else if (NULL != myglobals.prefix) {
|
} else if (NULL != myglobals.prefix) {
|
||||||
param = myglobals.prefix;
|
param = strdup(myglobals.prefix);
|
||||||
} else if (opal_cmd_line_is_taken(&cmd_line, "prefix")){
|
} else if (opal_cmd_line_is_taken(&cmd_line, "prefix")){
|
||||||
/* must be --prefix alone */
|
/* must be --prefix alone */
|
||||||
param = strdup(opal_cmd_line_get_param(&cmd_line, "prefix", 0, 0));
|
param = strdup(opal_cmd_line_get_param(&cmd_line, "prefix", 0, 0));
|
||||||
@ -1112,6 +1112,7 @@ static int create_app(int argc, char* argv[],
|
|||||||
if (0 == param_len) {
|
if (0 == param_len) {
|
||||||
orte_show_help("help-orterun.txt", "orterun:empty-prefix",
|
orte_show_help("help-orterun.txt", "orterun:empty-prefix",
|
||||||
true, myglobals.basename, myglobals.basename);
|
true, myglobals.basename, myglobals.basename);
|
||||||
|
free(param);
|
||||||
return ORTE_ERR_FATAL;
|
return ORTE_ERR_FATAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1489,6 +1490,8 @@ static int parse_appfile(orte_job_t *jdata, char *filename, char ***env)
|
|||||||
if (NULL != *env) {
|
if (NULL != *env) {
|
||||||
tmp_env = opal_argv_copy(*env);
|
tmp_env = opal_argv_copy(*env);
|
||||||
if (NULL == tmp_env) {
|
if (NULL == tmp_env) {
|
||||||
|
fclose(fp);
|
||||||
|
opal_argv_free(argv);
|
||||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1504,6 +1507,7 @@ static int parse_appfile(orte_job_t *jdata, char *filename, char ***env)
|
|||||||
if (NULL != tmp_env) {
|
if (NULL != tmp_env) {
|
||||||
opal_argv_free(tmp_env);
|
opal_argv_free(tmp_env);
|
||||||
}
|
}
|
||||||
|
opal_argv_free(argv);
|
||||||
if (made_app) {
|
if (made_app) {
|
||||||
app->idx = app_num;
|
app->idx = app_num;
|
||||||
++app_num;
|
++app_num;
|
||||||
@ -1517,6 +1521,7 @@ static int parse_appfile(orte_job_t *jdata, char *filename, char ***env)
|
|||||||
/* All done */
|
/* All done */
|
||||||
|
|
||||||
free(filename);
|
free(filename);
|
||||||
|
|
||||||
return ORTE_SUCCESS;
|
return ORTE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
* Copyright (c) 2007-2013 Los Alamos National Security, LLC. All rights
|
* Copyright (c) 2007-2013 Los Alamos National Security, LLC. All rights
|
||||||
* reserved.
|
* reserved.
|
||||||
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved.
|
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved.
|
||||||
|
* Copyright (c) 2015 Research Organization for Information Science
|
||||||
|
* and Technology (RIST). All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -758,7 +760,7 @@ int orterun(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
free(tmp_basename);
|
free(tmp_basename);
|
||||||
} else if (NULL != orterun_globals.path_to_mpirun) {
|
} else if (NULL != orterun_globals.path_to_mpirun) {
|
||||||
param = orterun_globals.path_to_mpirun;
|
param = strdup(orterun_globals.path_to_mpirun);
|
||||||
} else if (opal_cmd_line_is_taken(&cmd_line, "prefix")){
|
} else if (opal_cmd_line_is_taken(&cmd_line, "prefix")){
|
||||||
/* must be --prefix alone */
|
/* must be --prefix alone */
|
||||||
param = strdup(opal_cmd_line_get_param(&cmd_line, "prefix", 0, 0));
|
param = strdup(opal_cmd_line_get_param(&cmd_line, "prefix", 0, 0));
|
||||||
@ -776,12 +778,12 @@ int orterun(int argc, char *argv[])
|
|||||||
if (0 == param_len) {
|
if (0 == param_len) {
|
||||||
orte_show_help("help-orterun.txt", "orterun:empty-prefix",
|
orte_show_help("help-orterun.txt", "orterun:empty-prefix",
|
||||||
true, orte_basename, orte_basename);
|
true, orte_basename, orte_basename);
|
||||||
|
free(param);
|
||||||
return ORTE_ERR_FATAL;
|
return ORTE_ERR_FATAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
orterun_globals.prefix = strdup(param);
|
orterun_globals.prefix = param;
|
||||||
free(param);
|
|
||||||
}
|
}
|
||||||
want_prefix_by_default = true;
|
want_prefix_by_default = true;
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user