crs/none: fix coverity issues
CID 1301389 Resource leak (RESOURCE_LEAK) There is no conceivable reason to strdup cr_argv[0] in either location. Removed the calls to strdup. CID 741357 Resource leak (RESOURCE_LEAK) cr_argv was created by opal_argv_split (tmp_argv[0], ' '). Why should we call opal_argv_join (' ') on this array. Leak fixed by printing out tmp_argv[0] instead of calling opal_argv_join. CID 741358 Resource leak (RESOURCE_LEAK) The code does not handle exec failure correctly. The error should be communicated to the parent process but the function in question is only called by the parent. This calls into question some of the structure of the function in general (like what is the point of returning the child process id). That said, I will go ahead and add the opal_argv_free to quiet this error. Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
Этот коммит содержится в:
родитель
7e34997746
Коммит
f72b6d45c7
@ -1,8 +1,11 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2004-2010 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -101,8 +104,7 @@ int opal_crs_none_restart(opal_crs_base_snapshot_t *base_snapshot, bool spawn_ch
|
||||
opal_output(0,
|
||||
"crs:none: checkpoint(): Error: Unable to open the file (%s)",
|
||||
base_snapshot->metadata_filename);
|
||||
exit_status = OPAL_ERROR;
|
||||
goto cleanup;
|
||||
return OPAL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,10 +133,9 @@ int opal_crs_none_restart(opal_crs_base_snapshot_t *base_snapshot, bool spawn_ch
|
||||
if( !spawn_child ) {
|
||||
opal_output_verbose(10, opal_crs_base_framework.framework_output,
|
||||
"crs:none: none_restart: exec :(%s, %s):",
|
||||
strdup(cr_argv[0]),
|
||||
opal_argv_join(cr_argv, ' '));
|
||||
cr_argv[0], tmp_argv[0]);
|
||||
|
||||
status = execvp(strdup(cr_argv[0]), cr_argv);
|
||||
status = execvp(cr_argv[0], cr_argv);
|
||||
|
||||
if(status < 0) {
|
||||
opal_output(opal_crs_base_framework.framework_output,
|
||||
@ -152,10 +153,11 @@ int opal_crs_none_restart(opal_crs_base_snapshot_t *base_snapshot, bool spawn_ch
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (NULL != base_snapshot->metadata) {
|
||||
fclose(base_snapshot->metadata);
|
||||
if (cr_argv) {
|
||||
opal_argv_free (cr_argv);
|
||||
}
|
||||
base_snapshot->metadata = NULL;
|
||||
|
||||
fclose(base_snapshot->metadata);
|
||||
|
||||
return exit_status;
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user