Skip to content

Commit cdb3d79

Browse files
author
Ralph Castain
committed
Silence Coverity warnings
Signed-off-by: Ralph Castain <rhc@open-mpi.org>
1 parent d44e040 commit cdb3d79

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

orte/orted/pmix/pmix_server_gen.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,10 @@ static void _toolconn(int sd, short args, void *cbdata)
858858
} else if (0 == strcmp(val->key, OPAL_PMIX_RANK)) {
859859
tool.vpid = val->data.name.vpid;
860860
} else if (0 == strcmp(val->key, OPAL_PMIX_HOSTNAME)) {
861+
if (NULL != hostname) {
862+
/* shouldn't happen, but just take the last one */
863+
free(hostname);
864+
}
861865
hostname = strdup(val->data.string);
862866
}
863867
}
@@ -880,6 +884,9 @@ static void _toolconn(int sd, short args, void *cbdata)
880884
cd->toolcbfunc(ORTE_ERROR, tool, cd->cbdata);
881885
}
882886
OBJ_RELEASE(cd);
887+
if (NULL != hostname) {
888+
free(hostname);
889+
}
883890
return;
884891
}
885892
tool.jobid = jdata->jobid;
@@ -891,6 +898,9 @@ static void _toolconn(int sd, short args, void *cbdata)
891898
cd->toolcbfunc(ORTE_ERR_NOT_SUPPORTED, tool, cd->cbdata);
892899
}
893900
OBJ_RELEASE(cd);
901+
if (NULL != hostname) {
902+
free(hostname);
903+
}
894904
return;
895905
}
896906
} else {
@@ -956,6 +966,7 @@ static void _toolconn(int sd, short args, void *cbdata)
956966
ORTE_FLAG_SET(node, ORTE_NODE_NON_USABLE);
957967
opal_pointer_array_add(orte_node_pool, node);
958968
}
969+
free(hostname); // no longer needed
959970
}
960971
proc->node = node;
961972
OBJ_RETAIN(node); /* keep accounting straight */

0 commit comments

Comments
 (0)