orted/dfs: fix misc memory leaks
as reported by Coverity with CIDs 739887, 747706, 1196707-1196709 and 1269849
Этот коммит содержится в:
родитель
62a278d29c
Коммит
dd28b1f680
@ -3,6 +3,8 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 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
|
||||
@ -1649,6 +1651,9 @@ static void recv_dfs_cmd(int status, orte_process_name_t* sender,
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (NULL != read_buf) {
|
||||
free(read_buf);
|
||||
}
|
||||
/* send it */
|
||||
opal_output_verbose(1, orte_dfs_base_framework.framework_output,
|
||||
"%s sending %ld bytes back to %s",
|
||||
@ -1662,9 +1667,6 @@ static void recv_dfs_cmd(int status, orte_process_name_t* sender,
|
||||
OBJ_RELEASE(answer);
|
||||
return;
|
||||
}
|
||||
if (NULL != read_buf) {
|
||||
free(read_buf);
|
||||
}
|
||||
break;
|
||||
|
||||
case ORTE_DFS_POST_CMD:
|
||||
@ -2288,6 +2290,7 @@ static void remote_read(int fd, short args, void *cbdata)
|
||||
return;
|
||||
}
|
||||
}
|
||||
free(read_buf);
|
||||
/* send it */
|
||||
opal_output_verbose(1, orte_dfs_base_framework.framework_output,
|
||||
"%s sending %ld bytes back to %s",
|
||||
@ -2301,7 +2304,6 @@ static void remote_read(int fd, short args, void *cbdata)
|
||||
OBJ_RELEASE(answer);
|
||||
return;
|
||||
}
|
||||
free(read_buf);
|
||||
OBJ_RELEASE(req);
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Copyright (c) 2012-2013 Los Alamos National Security, LLC.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2014 Intel, Inc. All rights reserved
|
||||
* Copyright (c) 2014 Research Organization for Information Science
|
||||
* Copyright (c) 2014-2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -446,7 +446,7 @@ static void process_opens(int fd, short args, void *cbdata)
|
||||
orte_dfs_request_t *dfs = (orte_dfs_request_t*)cbdata;
|
||||
int rc;
|
||||
opal_buffer_t *buffer;
|
||||
char *scheme, *host, *filename, *hostname;
|
||||
char *scheme, *host, *filename;
|
||||
orte_process_name_t daemon;
|
||||
bool found;
|
||||
orte_vpid_t v;
|
||||
@ -465,8 +465,10 @@ static void process_opens(int fd, short args, void *cbdata)
|
||||
/* not yet supported */
|
||||
orte_show_help("orte_dfs_help.txt", "unsupported-filesystem",
|
||||
true, dfs->uri);
|
||||
free(scheme);
|
||||
goto complete;
|
||||
}
|
||||
free(scheme);
|
||||
|
||||
/* dissect the uri to extract host and filename/path */
|
||||
if (NULL == (filename = opal_filename_from_uri(dfs->uri, &host))) {
|
||||
@ -481,6 +483,7 @@ static void process_opens(int fd, short args, void *cbdata)
|
||||
daemon.jobid = ORTE_PROC_MY_DAEMON->jobid;
|
||||
found = false;
|
||||
for (v=0; v < orte_process_info.num_daemons; v++) {
|
||||
char *hostname;
|
||||
daemon.vpid = v;
|
||||
/* fetch the hostname where this daemon is located */
|
||||
OBJ_CONSTRUCT(&myvals, opal_list_t);
|
||||
@ -492,7 +495,7 @@ static void process_opens(int fd, short args, void *cbdata)
|
||||
goto complete;
|
||||
}
|
||||
kv = (opal_value_t*)opal_list_get_first(&myvals);
|
||||
hostname = strdup(kv->data.string);
|
||||
hostname = kv->data.string;
|
||||
OPAL_LIST_DESTRUCT(&myvals);
|
||||
opal_output(0, "%s GOT HOST %s HOSTNAME %s", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), host, hostname);
|
||||
if (0 == strcmp(host, hostname)) {
|
||||
@ -551,12 +554,20 @@ static void process_opens(int fd, short args, void *cbdata)
|
||||
goto complete;
|
||||
}
|
||||
/* don't release it */
|
||||
free(host);
|
||||
free(filename);
|
||||
return;
|
||||
|
||||
complete:
|
||||
/* we get here if an error occurred - execute any
|
||||
* pending callback so the proc doesn't hang
|
||||
*/
|
||||
if (NULL != host) {
|
||||
free(host);
|
||||
}
|
||||
if (NULL != filename) {
|
||||
free(filename);
|
||||
}
|
||||
if (NULL != dfs->open_cbfunc) {
|
||||
dfs->open_cbfunc(-1, dfs->cbdata);
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user