1
1

orte/tools: fix misc memory leaks

as reported by Coverity with CIDs 70700, 71039, 71854, 72384 and 710651
Этот коммит содержится в:
Gilles Gouaillardet 2015-03-02 20:06:14 +09:00
родитель d1b2f043ff
Коммит 4e7b5240e4
3 изменённых файлов: 15 добавлений и 4 удалений

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

@ -13,6 +13,8 @@
* Copyright (c) 2007-2013 Los Alamos National Security, LLC. 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$
*
* Additional copyrights may follow
@ -351,6 +353,7 @@ void kill_procs(void) {
*/
if (NULL == (inputline = orte_getline(psfile))) {
free(this_user);
fclose(psfile);
return;
}
free(inputline); /* dump the header line */
@ -441,5 +444,6 @@ void kill_procs(void) {
free(procname);
}
free(this_user);
fclose(psfile);
return;
}

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

@ -1094,7 +1094,7 @@ static int create_app(int argc, char* argv[],
}
free(value);
} else if (NULL != myglobals.prefix) {
param = myglobals.prefix;
param = strdup(myglobals.prefix);
} else if (opal_cmd_line_is_taken(&cmd_line, "prefix")){
/* must be --prefix alone */
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) {
orte_show_help("help-orterun.txt", "orterun:empty-prefix",
true, myglobals.basename, myglobals.basename);
free(param);
return ORTE_ERR_FATAL;
}
}
@ -1489,6 +1490,8 @@ static int parse_appfile(orte_job_t *jdata, char *filename, char ***env)
if (NULL != *env) {
tmp_env = opal_argv_copy(*env);
if (NULL == tmp_env) {
fclose(fp);
opal_argv_free(argv);
return ORTE_ERR_OUT_OF_RESOURCE;
}
} else {
@ -1504,6 +1507,7 @@ static int parse_appfile(orte_job_t *jdata, char *filename, char ***env)
if (NULL != tmp_env) {
opal_argv_free(tmp_env);
}
opal_argv_free(argv);
if (made_app) {
app->idx = app_num;
++app_num;
@ -1517,6 +1521,7 @@ static int parse_appfile(orte_job_t *jdata, char *filename, char ***env)
/* All done */
free(filename);
return ORTE_SUCCESS;
}

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

@ -15,6 +15,8 @@
* Copyright (c) 2007-2013 Los Alamos National Security, LLC. 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$
*
* Additional copyrights may follow
@ -758,7 +760,7 @@ int orterun(int argc, char *argv[])
}
free(tmp_basename);
} 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")){
/* must be --prefix alone */
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) {
orte_show_help("help-orterun.txt", "orterun:empty-prefix",
true, orte_basename, orte_basename);
free(param);
return ORTE_ERR_FATAL;
}
}
orterun_globals.prefix = strdup(param);
free(param);
orterun_globals.prefix = param;
}
want_prefix_by_default = true;
}