From 2b55ee81186b1d47cb18438b4214b4eb1f3958c8 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 20 Jul 2016 20:31:58 -0700 Subject: [PATCH] Cleanup Coverity warnings --- .../pmix/pmix2x/pmix/src/client/pmix_client_get.c | 6 +++--- .../pmix/pmix2x/pmix/src/server/pmix_server_get.c | 14 +++++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) mode change 100644 => 100755 opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_get.c mode change 100644 => 100755 opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_get.c diff --git a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_get.c b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_get.c old mode 100644 new mode 100755 index 0fc7dcd1f5..b167344472 --- a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_get.c +++ b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_get.c @@ -598,13 +598,13 @@ static void _getnbfn(int fd, short flags, void *cbdata) /* if we are seeking "pmix" data for our own nspace, then we must fail * as it was provided at startup - any updates would have come via * event notifications */ - if (0 == strncmp(cb->key, "pmix", 4) && + if (NULL != cb->key && 0 == strncmp(cb->key, "pmix", 4) && 0 == strncmp(cb->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN)) { cb->value_cbfunc(PMIX_ERR_NOT_FOUND, NULL, cb->cbdata); PMIX_RELEASE(cb); return; } - + /* see if we already have a request in place with the server for data from * this nspace:rank. If we do, then no need to ask again as the * request will return _all_ data from that proc */ @@ -631,7 +631,7 @@ static void _getnbfn(int fd, short flags, void *cbdata) "%s:%d REQUESTING DATA FROM SERVER FOR %s:%d KEY %s", pmix_globals.myid.nspace, pmix_globals.myid.rank, cb->nspace, cb->rank, cb->key); - + /* create a callback object as we need to pass it to the * recv routine so we know which callback to use when * the return message is recvd */ diff --git a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_get.c b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_get.c old mode 100644 new mode 100755 index 66189c6c27..85de896e9e --- a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_get.c +++ b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_get.c @@ -103,7 +103,9 @@ static pmix_status_t create_local_tracker(char nspace[], int rank, static void relfn(void *cbdata) { char *data = (char*)cbdata; - free(data); + if (NULL != data) { + free(data); + } } @@ -199,7 +201,7 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, cbfunc(PMIX_SUCCESS, data, sz, cbdata, relfn, data); return PMIX_SUCCESS; } - + /* We have to wait for all local clients to be registered before * we can know whether this request is for data from a local or a * remote client because one client might ask for data about another @@ -419,7 +421,8 @@ static pmix_status_t _satisfy_request(pmix_nspace_t *nptr, int rank, pmix_serve cur_rank = PMIX_RANK_WILDCARD; if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(&pbkt, &cur_rank, 1, PMIX_INT))) { PMIX_ERROR_LOG(rc); - cbfunc(rc, NULL, 0, cbdata, relfn, data); + PMIX_DESTRUCT(&pbkt); + cbfunc(rc, NULL, 0, cbdata, NULL, NULL); return rc; } /* the client is expecting this to arrive as a byte object @@ -427,11 +430,12 @@ static pmix_status_t _satisfy_request(pmix_nspace_t *nptr, int rank, pmix_serve pbptr = &nptr->server->job_info; if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(&pbkt, &pbptr, 1, PMIX_BUFFER))) { PMIX_ERROR_LOG(rc); - cbfunc(rc, NULL, 0, cbdata, relfn, data); + PMIX_DESTRUCT(&pbkt); + cbfunc(rc, NULL, 0, cbdata, NULL, NULL); return rc; } } - + while (NULL != *htptr) { cur_rank = rank; if (PMIX_RANK_UNDEF == rank) {