Skip to content

Commit c09899f

Browse files
committed
plm: plus resource leaks
as reported by Coverity with CIDs 72274 and 1196733
1 parent 44a66e2 commit c09899f

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

orte/mca/plm/base/plm_base_launch_support.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* et Automatique. All rights reserved.
1515
* Copyright (c) 2011-2012 Los Alamos National Security, LLC.
1616
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
17-
* Copyright (c) 2014-2015 Research Organization for Information Science
17+
* Copyright (c) 2014-2016 Research Organization for Information Science
1818
* and Technology (RIST). All rights reserved.
1919
* Copyright (c) 2016 IBM Corporation. All rights reserved.
2020
* $COPYRIGHT$
@@ -854,7 +854,6 @@ void orte_plm_base_daemon_callback(int status, orte_process_name_t* sender,
854854
char *rml_uri = NULL, *ptr;
855855
int rc, idx;
856856
orte_proc_t *daemon=NULL;
857-
char *nodename;
858857
orte_node_t *node;
859858
orte_job_t *jdata;
860859
orte_process_name_t dname;
@@ -875,6 +874,7 @@ void orte_plm_base_daemon_callback(int status, orte_process_name_t* sender,
875874
/* multiple daemons could be in this buffer, so unpack until we exhaust the data */
876875
idx = 1;
877876
while (OPAL_SUCCESS == (rc = opal_dss.unpack(buffer, &dname, &idx, ORTE_NAME))) {
877+
char *nodename;
878878
/* unpack its contact info */
879879
idx = 1;
880880
if (ORTE_SUCCESS != (rc = opal_dss.unpack(buffer, &rml_uri, &idx, OPAL_STRING))) {
@@ -1145,6 +1145,11 @@ void orte_plm_base_daemon_callback(int status, orte_process_name_t* sender,
11451145
ORTE_NAME_PRINT(&dname),
11461146
(NULL == daemon) ? "UNKNOWN" : daemon->rml_uri));
11471147

1148+
if (NULL != nodename) {
1149+
free(nodename);
1150+
nodename = NULL;
1151+
}
1152+
11481153
if (orted_failed_launch) {
11491154
ORTE_ACTIVATE_JOB_STATE(jdatorted, ORTE_JOB_STATE_FAILED_TO_START);
11501155
return;
@@ -1180,10 +1185,6 @@ void orte_plm_base_daemon_callback(int status, orte_process_name_t* sender,
11801185
}
11811186
}
11821187
}
1183-
if (NULL != nodename) {
1184-
free(nodename);
1185-
nodename = NULL;
1186-
}
11871188
idx = 1;
11881189
}
11891190
if (ORTE_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc) {

orte/mca/plm/rsh/plm_rsh_module.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved.
1616
* Copyright (c) 2011 IBM Corporation. All rights reserved.
1717
* Copyright (c) 2014-2015 Intel Corporation. All rights reserved.
18-
* Copyright (c) 2015 Research Organization for Information Science
18+
* Copyright (c) 2015-2016 Research Organization for Information Science
1919
* and Technology (RIST). All rights reserved.
2020
* $COPYRIGHT$
2121
*
@@ -1429,6 +1429,9 @@ static int launch_agent_setup(const char *agent, char *path)
14291429
}
14301430
}
14311431
}
1432+
if (NULL != bname) {
1433+
free(bname);
1434+
}
14321435

14331436
/* the caller can append any additional argv's they desire */
14341437
return ORTE_SUCCESS;

0 commit comments

Comments
 (0)