Skip to content

Commit 1d44f0c

Browse files
author
Ralph Castain
committed
Silence Coverity warnings
1 parent 82240f5 commit 1d44f0c

File tree

4 files changed

+26
-12
lines changed

4 files changed

+26
-12
lines changed

opal/mca/pmix/pmix2x/pmix/VERSION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ greek=
3030
# command, or with the date (if "git describe" fails) in the form of
3131
# "date<date>".
3232

33-
repo_rev=gitc2e543b
33+
repo_rev=gitdff97ad
3434

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

4545
# The date when this release was created
4646

47-
date="Aug 10, 2016"
47+
date="Aug 11, 2016"
4848

4949
# The shared library version of each of PMIx's public libraries.
5050
# These versions are maintained in accordance with the "Library

opal/mca/pmix/pmix2x/pmix/src/buffer_ops/copy.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -679,11 +679,15 @@ pmix_status_t pmix_value_xfer(pmix_value_t *p, pmix_value_t *src)
679679
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(pmix_persistence_t));
680680
break;
681681
case PMIX_POINTER:
682-
p->data.darray.array = (void**)malloc(src->data.darray.size * sizeof(void*));
682+
p->data.darray.array = (char**)malloc(src->data.darray.size * sizeof(char*));
683683
if (NULL == p->data.darray.array) {
684684
return PMIX_ERR_NOMEM;
685685
}
686-
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(void*));
686+
prarray = (char**)p->data.darray.array;
687+
strarray = (char**)src->data.darray.array;
688+
for (n=0; n < src->data.darray.size; n++) {
689+
prarray[n] = strarray[n];
690+
}
687691
break;
688692
case PMIX_SCOPE:
689693
p->data.darray.array = (pmix_scope_t*)malloc(src->data.darray.size * sizeof(pmix_scope_t));
@@ -1135,6 +1139,8 @@ pmix_status_t pmix_bfrop_copy_darray(pmix_data_array_t **dest,
11351139
sv = (pmix_value_t*)src->array;
11361140
for (n=0; n < src->size; n++) {
11371141
if (PMIX_SUCCESS != (rc = pmix_value_xfer(&pv[n], &sv[n]))) {
1142+
PMIX_VALUE_FREE(pv, src->size);
1143+
free(p);
11381144
return rc;
11391145
}
11401146
}
@@ -1265,6 +1271,8 @@ pmix_status_t pmix_bfrop_copy_darray(pmix_data_array_t **dest,
12651271
return PMIX_ERR_NOMEM;
12661272
}
12671273
if (PMIX_SUCCESS != (rc = pmix_value_xfer(pk[n].value, sk[n].value))) {
1274+
PMIX_VALUE_FREE(pk[n].value, 1);
1275+
free(p);
12681276
return rc;
12691277
}
12701278
}
@@ -1283,6 +1291,7 @@ pmix_status_t pmix_bfrop_copy_darray(pmix_data_array_t **dest,
12831291
if (NULL != sm[n].blob && 0 < sm[n].size) {
12841292
pm[n].blob = (uint8_t*)malloc(sm[n].size);
12851293
if (NULL == pm[n].blob) {
1294+
PMIX_MODEX_FREE(pm, src->size);
12861295
free(p);
12871296
return PMIX_ERR_NOMEM;
12881297
}
@@ -1303,12 +1312,12 @@ pmix_status_t pmix_bfrop_copy_darray(pmix_data_array_t **dest,
13031312
memcpy(p->array, src->array, src->size * sizeof(pmix_persistence_t));
13041313
break;
13051314
case PMIX_POINTER:
1306-
p->array = (void**)malloc(src->size * sizeof(void*));
1307-
if (NULL == p->array) {
1308-
free(p);
1309-
return PMIX_ERR_NOMEM;
1315+
p->array = (char**)malloc(src->size * sizeof(char*));
1316+
prarray = (char**)p->array;
1317+
strarray = (char**)src->array;
1318+
for (n=0; n < src->size; n++) {
1319+
prarray[n] = strarray[n];
13101320
}
1311-
memcpy(p->array, src->array, src->size * sizeof(void*));
13121321
break;
13131322
case PMIX_SCOPE:
13141323
p->array = (pmix_scope_t*)malloc(src->size * sizeof(pmix_scope_t));

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ static pmix_status_t process_val(pmix_value_t *val,
392392
{
393393
pmix_info_t *info;
394394
size_t n, nsize, nvals;
395+
pmix_status_t rc;
395396

396397
if (NULL == val) {
397398
/* this is an error */
@@ -418,7 +419,9 @@ static pmix_status_t process_val(pmix_value_t *val,
418419
}
419420
nvals = 0;
420421
for (n=0; n < nsize; n++) {
421-
pmix_pointer_array_add(results, &info[n]);
422+
if (PMIX_SUCCESS != (rc = pmix_pointer_array_add(results, &info[n]))) {
423+
return rc;
424+
}
422425
++nvals;
423426
}
424427
if (PMIX_DATA_ARRAY == val->type) {

opal/mca/pmix/pmix2x/pmix/src/tool/pmix_tool.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,11 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc,
233233
} else if (strcmp(info[n].key, PMIX_CONNECT_SYSTEM_FIRST) == 0) {
234234
connect_to_system_first = info[n].value.data.flag;
235235
connection_defined = true;
236-
} else if (strcmp(info[n].key, PMIX_SERVER_TMPDIR) == 0) {
236+
} else if (strcmp(info[n].key, PMIX_SERVER_TMPDIR) == 0 &&
237+
NULL == mytmpdir) {
237238
mytmpdir = strdup(info[n].value.data.string);
238-
} else if (strcmp(info[n].key, PMIX_SYSTEM_TMPDIR) == 0) {
239+
} else if (strcmp(info[n].key, PMIX_SYSTEM_TMPDIR) == 0 &&
240+
NULL == systmpdir) {
239241
systmpdir = strdup(info[n].value.data.string);
240242
}
241243
}

0 commit comments

Comments
 (0)