Skip to content

Commit

Permalink
Merge pull request #52 from rhc54/topic/cov
Browse files Browse the repository at this point in the history
Silence Coverity warnings
  • Loading branch information
Ralph Castain committed Apr 18, 2018
2 parents 9cc2cca + 7e7df3d commit 1aec6c4
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 44 deletions.
4 changes: 2 additions & 2 deletions opal/mca/pmix/pmix3x/pmix/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ greek=
# command, or with the date (if "git describe" fails) in the form of
# "date<date>".

repo_rev=gita741222
repo_rev=gitd8068ab

# If tarball_version is not empty, it is used as the version string in
# the tarball filename, regardless of all other versions listed in
Expand All @@ -44,7 +44,7 @@ tarball_version=

# The date when this release was created

date="Apr 16, 2018"
date="Apr 17, 2018"

# The shared library version of each of PMIx's public libraries.
# These versions are maintained in accordance with the "Library
Expand Down
12 changes: 0 additions & 12 deletions opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,6 @@ typedef uint32_t pmix_rank_t;
/* define an invalid value */
#define PMIX_RANK_INVALID UINT32_MAX-3

/**** PMIX ENVIRONMENTAL PARAMETERS ****/
/* There are a few environmental parameters used by PMIx for
* various operations. While there is no "definition" of them
* as values, we do record them here for informational purposes.
*
* PMIX_LAUNCHER_PAUSE_FOR_TOOL - if set to non-zero value, instructs
* launchers (e.g., "prun") to stop prior to spawning the application until
* a tool can connect with further instructions. This envar will be
* set by the tool and is _not_ intended for the direct use of users.
*
*/

/**** PMIX ENVIRONMENTAL PARAMETERS ****/
/* There are a few environmental parameters used by PMIx for
* various operations. While there is no "definition" of them
Expand Down
24 changes: 16 additions & 8 deletions opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ pmix_status_t pmix_pnet_base_allocate(char *nspace,
if (PMIX_SUCCESS == (rc = active->module->allocate(nptr, NULL, ilist))) {
break;
}
}
if (PMIX_ERR_TAKE_NEXT_OPTION != rc) {
/* true error */
return rc;
if (PMIX_ERR_TAKE_NEXT_OPTION != rc) {
/* true error */
return rc;
}
}
}
} else {
Expand All @@ -90,10 +90,10 @@ pmix_status_t pmix_pnet_base_allocate(char *nspace,
if (PMIX_SUCCESS == (rc = active->module->allocate(nptr, &info[n], ilist))) {
break;
}
}
if (PMIX_ERR_TAKE_NEXT_OPTION != rc) {
/* true error */
return rc;
if (PMIX_ERR_TAKE_NEXT_OPTION != rc) {
/* true error */
return rc;
}
}
}
}
Expand Down Expand Up @@ -395,6 +395,7 @@ static void cicbfunc(pmix_status_t status,
}
/* now call the requestor back */
lock->cbfunc(ret, lock->info, lock->ninfo, lock->cbdata, cirelease, lock);
PMIX_RELEASE_THREAD(&lock->lock);
return;

error:
Expand Down Expand Up @@ -496,16 +497,23 @@ pmix_status_t pmix_pnet_base_harvest_envars(char **incvars, char **excvars,
cs_env = strdup(environ[i]);
kv = PMIX_NEW(pmix_kval_t);
if (NULL == kv) {
free(cs_env);
return PMIX_ERR_OUT_OF_RESOURCE;
}
kv->key = strdup(PMIX_SET_ENVAR);
kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t));
if (NULL == kv->value) {
PMIX_RELEASE(kv);
free(cs_env);
return PMIX_ERR_OUT_OF_RESOURCE;
}
kv->value->type = PMIX_ENVAR;
string_key = strchr(cs_env, '=');
if (NULL == string_key) {
free(cs_env);
PMIX_RELEASE(kv);
return PMIX_ERR_BAD_PARAM;
}
*string_key = '\0';
++string_key;
PMIX_ENVAR_LOAD(&kv->value->data.envar, cs_env, string_key, ':');
Expand Down
42 changes: 23 additions & 19 deletions opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,25 +540,25 @@ static pmix_status_t allocate(pmix_nspace_t *nptr,
if (NULL == avail) {
continue;
}
/* setup to track the assignment */
trk = PMIX_NEW(tcp_port_tracker_t);
if (NULL == trk) {
pmix_argv_free(reqs);
return PMIX_ERR_NOMEM;
}
trk->nspace = strdup(nptr->nspace);
PMIX_RETAIN(avail);
trk->src = avail;
pmix_list_append(&allocations, &trk->super);
rc = process_request(nptr, idkey, ports_per_node, trk, &mylist);
if (PMIX_SUCCESS != rc) {
/* return the allocated ports */
pmix_list_remove_item(&allocations, &trk->super);
PMIX_RELEASE(trk);
return rc;
}
allocated = true;
}
/* setup to track the assignment */
trk = PMIX_NEW(tcp_port_tracker_t);
if (NULL == trk) {
pmix_argv_free(reqs);
return PMIX_ERR_NOMEM;
}
trk->nspace = strdup(nptr->nspace);
PMIX_RETAIN(avail);
trk->src = avail;
pmix_list_append(&allocations, &trk->super);
rc = process_request(nptr, idkey, ports_per_node, trk, &mylist);
if (PMIX_SUCCESS != rc) {
/* return the allocated ports */
pmix_list_remove_item(&allocations, &trk->super);
PMIX_RELEASE(trk);
return rc;
}
allocated = true;
}
} else {
avail = (tcp_available_ports_t*)pmix_list_get_first(&available);
Expand Down Expand Up @@ -695,7 +695,8 @@ static pmix_status_t setup_local_network(pmix_nspace_t *nptr,
PMIX_BFROPS_VALUE_XFER(rc, pmix_globals.mypeer,
&jinfo[m].value, kv->value);
/* if this is the ID key, save it */
if (0 == strncmp(kv->key, PMIX_ALLOC_NETWORK_ID, PMIX_MAX_KEYLEN)) {
if (NULL == idkey &&
0 == strncmp(kv->key, PMIX_ALLOC_NETWORK_ID, PMIX_MAX_KEYLEN)) {
idkey = strdup(kv->value->data.string);
}
++m;
Expand Down Expand Up @@ -730,6 +731,9 @@ static pmix_status_t setup_local_network(pmix_nspace_t *nptr,
}
}
}
if (NULL != idkey) {
free(idkey);
}
return PMIX_SUCCESS;
}

Expand Down
9 changes: 6 additions & 3 deletions opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/pnet_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static pmix_status_t allocate(pmix_nspace_t *nptr,
pmix_list_t *ilist)
{
pmix_kval_t *kv;
bool seckey;
bool seckey = false;
pmix_list_t mylist;
size_t n, nreqs=0;
pmix_info_t *requests = NULL;
Expand Down Expand Up @@ -319,7 +319,8 @@ static pmix_status_t setup_local_network(pmix_nspace_t *nptr,
PMIX_BFROPS_VALUE_XFER(rc, pmix_globals.mypeer,
&jinfo[m].value, kv->value);
/* if this is the ID key, save it */
if (0 == strncmp(kv->key, PMIX_ALLOC_NETWORK_ID, PMIX_MAX_KEYLEN)) {
if (NULL == idkey &&
0 == strncmp(kv->key, PMIX_ALLOC_NETWORK_ID, PMIX_MAX_KEYLEN)) {
idkey = strdup(kv->value->data.string);
}
++m;
Expand Down Expand Up @@ -354,7 +355,9 @@ static pmix_status_t setup_local_network(pmix_nspace_t *nptr,
}
}
}

if (NULL != idkey) {
free(idkey);
}
return PMIX_SUCCESS;
}

Expand Down
2 changes: 2 additions & 0 deletions opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,11 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,

/* open the pnet framework and select the active modules for this environment */
if (PMIX_SUCCESS != (rc = pmix_mca_base_framework_open(&pmix_pnet_base_framework, 0))) {
PMIX_RELEASE_THREAD(&pmix_global_lock);
return rc;
}
if (PMIX_SUCCESS != (rc = pmix_pnet_base_select())) {
PMIX_RELEASE_THREAD(&pmix_global_lock);
return rc;
}

Expand Down

0 comments on commit 1aec6c4

Please sign in to comment.