Plug a few memory leaks identified by valgrind
Этот коммит содержится в:
родитель
1474bb212a
Коммит
749bd4e6fe
@ -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);
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -354,7 +354,7 @@ void pmix1_value_load(pmix_value_t *v,
|
||||
default:
|
||||
/* silence warnings */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int pmix1_value_unload(opal_value_t *kv,
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user