diff --git a/opal/mca/pmix/pmix.h b/opal/mca/pmix/pmix.h index 5ba4bb0078..c8e26b315d 100644 --- a/opal/mca/pmix/pmix.h +++ b/opal/mca/pmix/pmix.h @@ -62,9 +62,9 @@ extern int opal_pmix_base_exchange(opal_value_t *info, OPAL_ERROR_LOG((r)); \ } \ } \ - /* do not destruct the keyval as we don't own */ \ - /* the data - the caller will take care of the */ \ - /* key and value storage, and the kv itself has none */ \ + /* opal_value_load makes a copy of the data, so release it */ \ + _kv.key = NULL; \ + OBJ_DESTRUCT(&(_kv)); \ } while(0); /** diff --git a/opal/mca/pmix/pmix1xx/pmix/src/server/pmix_server.c b/opal/mca/pmix/pmix1xx/pmix/src/server/pmix_server.c index 6bca5c1112..02e715f661 100644 --- a/opal/mca/pmix/pmix1xx/pmix/src/server/pmix_server.c +++ b/opal/mca/pmix/pmix1xx/pmix/src/server/pmix_server.c @@ -102,9 +102,16 @@ PMIX_CLASS_INSTANCE(pmix_usock_queue_t, static void scon(pmix_shift_caddy_t *p) { p->active = false; + p->kv = NULL; p->relfn = NULL; p->relcbd = NULL; } +static void scdes(pmix_shift_caddy_t *p) +{ + if (NULL != p->kv) { + PMIX_RELEASE(p->kv); + } +} PMIX_CLASS_INSTANCE(pmix_shift_caddy_t, pmix_object_t, scon, NULL); diff --git a/opal/mca/pmix/pmix1xx/pmix1_client.c b/opal/mca/pmix/pmix1xx/pmix1_client.c index 1f25b35504..c2dbf37a08 100644 --- a/opal/mca/pmix/pmix1xx/pmix1_client.c +++ b/opal/mca/pmix/pmix1xx/pmix1_client.c @@ -131,6 +131,7 @@ int pmix1_abort(int flag, const char *msg, pmix_proc_t *parray=NULL; size_t n, cnt=0; opal_namelist_t *ptr; + char *tmp; opal_output_verbose(1, opal_pmix_base_framework.framework_output, "PMIx_client abort"); @@ -141,7 +142,9 @@ int pmix1_abort(int flag, const char *msg, PMIX_PROC_CREATE(parray, cnt); n=0; OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) { - (void)strncpy(parray[n].nspace, opal_convert_jobid_to_string(ptr->name.jobid), PMIX_MAX_NSLEN); + tmp = opal_convert_jobid_to_string(ptr->name.jobid); + (void)strncpy(parray[n].nspace, tmp, PMIX_MAX_NSLEN); + free(tmp); parray[n].rank = ptr->name.vpid; ++n; } @@ -181,6 +184,7 @@ int pmix1_fence(opal_list_t *procs, int collect_data) size_t n, cnt=0; opal_namelist_t *ptr; pmix_info_t info, *iptr; + char *tmp; opal_output_verbose(1, opal_pmix_base_framework.framework_output, "PMIx_client fence"); @@ -191,7 +195,9 @@ int pmix1_fence(opal_list_t *procs, int collect_data) PMIX_PROC_CREATE(parray, cnt); n=0; OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) { - (void)strncpy(parray[n].nspace, opal_convert_jobid_to_string(ptr->name.jobid), PMIX_MAX_NSLEN); + tmp = opal_convert_jobid_to_string(ptr->name.jobid); + (void)strncpy(parray[n].nspace, tmp, PMIX_MAX_NSLEN); + free(tmp); parray[n].rank = ptr->name.vpid; ++n; } @@ -230,6 +236,7 @@ int pmix1_fencenb(opal_list_t *procs, int collect_data, opal_namelist_t *ptr; pmix1_opcaddy_t *op; pmix_info_t info, *iptr; + char *tmp; opal_output_verbose(1, opal_pmix_base_framework.framework_output, "PMIx_client fence_nb"); @@ -240,7 +247,9 @@ int pmix1_fencenb(opal_list_t *procs, int collect_data, PMIX_PROC_CREATE(parray, cnt); n=0; OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) { - (void)strncpy(parray[n].nspace, opal_convert_jobid_to_string(ptr->name.jobid), PMIX_MAX_NSLEN); + tmp = opal_convert_jobid_to_string(ptr->name.jobid); + (void)strncpy(parray[n].nspace, tmp, PMIX_MAX_NSLEN); + free(tmp); parray[n].rank = ptr->name.vpid; ++n; } @@ -300,6 +309,7 @@ int pmix1_get(const opal_process_name_t *proc, const char *key, size_t ninfo, n; pmix_info_t *pinfo; opal_value_t *ival; + char *tmp; opal_output_verbose(1, opal_pmix_base_framework.framework_output, "%s PMIx_client get on proc %s key %s", @@ -310,7 +320,9 @@ int pmix1_get(const opal_process_name_t *proc, const char *key, *val = NULL; if (NULL != proc) { /* convert the process jobid */ - (void)strncpy(p.nspace, opal_convert_jobid_to_string(proc->jobid), PMIX_MAX_NSLEN); + tmp = opal_convert_jobid_to_string(proc->jobid); + (void)strncpy(p.nspace, tmp, PMIX_MAX_NSLEN); + free(tmp); p.rank = proc->vpid; pptr = &p; } else { @@ -918,6 +930,7 @@ int pmix1_disconnect(opal_list_t *procs) pmix_proc_t *parray=NULL; size_t n, cnt=0; opal_namelist_t *ptr; + char *tmp; /* protect against bozo error */ if (NULL == procs || 0 == (cnt = opal_list_get_size(procs))) { @@ -929,7 +942,9 @@ int pmix1_disconnect(opal_list_t *procs) PMIX_PROC_CREATE(parray, cnt); n=0; OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) { - (void)strncpy(parray[n].nspace, opal_convert_jobid_to_string(ptr->name.jobid), PMIX_MAX_NSLEN); + tmp = opal_convert_jobid_to_string(ptr->name.jobid); + (void)strncpy(parray[n].nspace, tmp, PMIX_MAX_NSLEN); + free(tmp); if (OPAL_VPID_WILDCARD == ptr->name.vpid) { parray[n].rank = PMIX_RANK_WILDCARD; } else { @@ -1004,6 +1019,9 @@ int pmix1_resolve_peers(const char *nodename, opal_jobid_t jobid, } ret = PMIx_Resolve_peers(nodename, nspace, &array, &nprocs); + if (NULL != nspace) { + free(nspace); + } rc = pmix1_convert_rc(ret); if (NULL != array && 0 < nprocs) { @@ -1012,9 +1030,6 @@ int pmix1_resolve_peers(const char *nodename, opal_jobid_t jobid, opal_list_append(procs, &nm->super); rc = opal_convert_string_to_jobid(&nm->name.jobid, array[n].nspace); if (OPAL_SUCCESS != rc) { - if (NULL != nspace) { - free(nspace); - } PMIX_PROC_FREE(array, nprocs); return rc; } diff --git a/opal/mca/pmix/pmix1xx/pmix_pmix1.c b/opal/mca/pmix/pmix1xx/pmix_pmix1.c index 316566a983..b900230f54 100644 --- a/opal/mca/pmix/pmix1xx/pmix_pmix1.c +++ b/opal/mca/pmix/pmix1xx/pmix_pmix1.c @@ -354,7 +354,7 @@ void pmix1_value_load(pmix_value_t *v, default: /* silence warnings */ break; - } + } } int pmix1_value_unload(opal_value_t *kv, diff --git a/orte/mca/ess/base/ess_base_std_app.c b/orte/mca/ess/base/ess_base_std_app.c index 9b78e7b66b..ab3a09b864 100644 --- a/orte/mca/ess/base/ess_base_std_app.c +++ b/orte/mca/ess/base/ess_base_std_app.c @@ -103,7 +103,7 @@ int orte_ess_base_app_setup(bool db_restrict_local) * do so here */ if (ORTE_PROC_NON_MPI) { orte_process_info.super.proc_name = *(opal_process_name_t*)ORTE_PROC_MY_NAME; - orte_process_info.super.proc_hostname = strdup(orte_process_info.nodename); + orte_process_info.super.proc_hostname = orte_process_info.nodename; orte_process_info.super.proc_flags = OPAL_PROC_ALL_LOCAL; orte_process_info.super.proc_arch = opal_local_arch; opal_proc_local_set(&orte_process_info.super); diff --git a/orte/mca/ess/pmi/ess_pmi_module.c b/orte/mca/ess/pmi/ess_pmi_module.c index 7f6bfff6bf..4b411a68f7 100644 --- a/orte/mca/ess/pmi/ess_pmi_module.c +++ b/orte/mca/ess/pmi/ess_pmi_module.c @@ -186,6 +186,7 @@ static int rte_init(void) } /* retrieve our topology */ + val = NULL; OPAL_MODEX_RECV_VALUE_OPTIONAL(ret, OPAL_PMIX_LOCAL_TOPO, ORTE_PROC_MY_NAME, &val, OPAL_STRING); if (OPAL_SUCCESS == ret && NULL != val) { diff --git a/orte/util/proc_info.c b/orte/util/proc_info.c index dba803fa16..b5a883eaed 100644 --- a/orte/util/proc_info.c +++ b/orte/util/proc_info.c @@ -309,6 +309,11 @@ int orte_proc_info_finalize(void) orte_process_info.nodename = NULL; } + if (NULL != orte_process_info.cpuset) { + free(orte_process_info.cpuset); + orte_process_info.cpuset = NULL; + } + if (NULL != orte_process_info.sock_stdin) { free(orte_process_info.sock_stdin); orte_process_info.sock_stdin = NULL;