Skip to content

Commit 58e9cac

Browse files
author
rhc54
authored
Merge pull request #1892 from rhc54/topic/covclean
Cleanup Coverity warnings
2 parents af15ec3 + 2b55ee8 commit 58e9cac

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_get.c

100644100755
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,13 +598,13 @@ static void _getnbfn(int fd, short flags, void *cbdata)
598598
/* if we are seeking "pmix" data for our own nspace, then we must fail
599599
* as it was provided at startup - any updates would have come via
600600
* event notifications */
601-
if (0 == strncmp(cb->key, "pmix", 4) &&
601+
if (NULL != cb->key && 0 == strncmp(cb->key, "pmix", 4) &&
602602
0 == strncmp(cb->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN)) {
603603
cb->value_cbfunc(PMIX_ERR_NOT_FOUND, NULL, cb->cbdata);
604604
PMIX_RELEASE(cb);
605605
return;
606606
}
607-
607+
608608
/* see if we already have a request in place with the server for data from
609609
* this nspace:rank. If we do, then no need to ask again as the
610610
* request will return _all_ data from that proc */
@@ -631,7 +631,7 @@ static void _getnbfn(int fd, short flags, void *cbdata)
631631
"%s:%d REQUESTING DATA FROM SERVER FOR %s:%d KEY %s",
632632
pmix_globals.myid.nspace, pmix_globals.myid.rank,
633633
cb->nspace, cb->rank, cb->key);
634-
634+
635635
/* create a callback object as we need to pass it to the
636636
* recv routine so we know which callback to use when
637637
* the return message is recvd */

opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_get.c

100644100755
Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ static pmix_status_t create_local_tracker(char nspace[], int rank,
103103
static void relfn(void *cbdata)
104104
{
105105
char *data = (char*)cbdata;
106-
free(data);
106+
if (NULL != data) {
107+
free(data);
108+
}
107109
}
108110

109111

@@ -199,7 +201,7 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf,
199201
cbfunc(PMIX_SUCCESS, data, sz, cbdata, relfn, data);
200202
return PMIX_SUCCESS;
201203
}
202-
204+
203205
/* We have to wait for all local clients to be registered before
204206
* we can know whether this request is for data from a local or a
205207
* remote client because one client might ask for data about another
@@ -419,19 +421,21 @@ static pmix_status_t _satisfy_request(pmix_nspace_t *nptr, int rank, pmix_serve
419421
cur_rank = PMIX_RANK_WILDCARD;
420422
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(&pbkt, &cur_rank, 1, PMIX_INT))) {
421423
PMIX_ERROR_LOG(rc);
422-
cbfunc(rc, NULL, 0, cbdata, relfn, data);
424+
PMIX_DESTRUCT(&pbkt);
425+
cbfunc(rc, NULL, 0, cbdata, NULL, NULL);
423426
return rc;
424427
}
425428
/* the client is expecting this to arrive as a byte object
426429
* containing a buffer, so package it accordingly */
427430
pbptr = &nptr->server->job_info;
428431
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(&pbkt, &pbptr, 1, PMIX_BUFFER))) {
429432
PMIX_ERROR_LOG(rc);
430-
cbfunc(rc, NULL, 0, cbdata, relfn, data);
433+
PMIX_DESTRUCT(&pbkt);
434+
cbfunc(rc, NULL, 0, cbdata, NULL, NULL);
431435
return rc;
432436
}
433437
}
434-
438+
435439
while (NULL != *htptr) {
436440
cur_rank = rank;
437441
if (PMIX_RANK_UNDEF == rank) {

0 commit comments

Comments
 (0)