Skip to content

Commit 661d6be

Browse files
committed
Silence more Coverity warnings
488202 488201 488200 488197 488196 488194 488193 488191 488189 488188 488187 488185 Signed-off-by: Ralph Castain <[email protected]>
1 parent cf3efbb commit 661d6be

File tree

9 files changed

+67
-26
lines changed

9 files changed

+67
-26
lines changed

src/mca/grpcomm/direct/grpcomm_direct_group.c

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -226,19 +226,43 @@ static void group(int sd, short args, void *cbdata)
226226
PMIx_Info_list_convert(grpinfo, &darray);
227227
info = (pmix_info_t*)darray.array;
228228
ninfo = darray.size;
229-
PMIx_Data_pack(NULL, relay, &ninfo, 1, PMIX_SIZE);
229+
rc = PMIx_Data_pack(NULL, relay, &ninfo, 1, PMIX_SIZE);
230+
if (PMIX_SUCCESS != rc) {
231+
PMIX_ERROR_LOG(rc);
232+
PMIX_DATA_BUFFER_RELEASE(relay);
233+
PMIX_DESTRUCT(&sig);
234+
goto error;
235+
}
230236
if (0 < ninfo) {
231-
PMIx_Data_pack(NULL, relay, info, ninfo, PMIX_INFO);
237+
rc = PMIx_Data_pack(NULL, relay, info, ninfo, PMIX_INFO);
238+
if (PMIX_SUCCESS != rc) {
239+
PMIX_ERROR_LOG(rc);
240+
PMIX_DATA_BUFFER_RELEASE(relay);
241+
PMIX_DESTRUCT(&sig);
242+
goto error;
243+
}
232244
}
233245
PMIX_DATA_ARRAY_DESTRUCT(&darray);
234246

235247
// pack any endpts
236248
PMIx_Info_list_convert(endpts, &darray);
237249
info = (pmix_info_t*)darray.array;
238250
ninfo = darray.size;
239-
PMIx_Data_pack(NULL, relay, &ninfo, 1, PMIX_SIZE);
251+
rc = PMIx_Data_pack(NULL, relay, &ninfo, 1, PMIX_SIZE);
252+
if (PMIX_SUCCESS != rc) {
253+
PMIX_ERROR_LOG(rc);
254+
PMIX_DATA_BUFFER_RELEASE(relay);
255+
PMIX_DESTRUCT(&sig);
256+
goto error;
257+
}
240258
if (0 < ninfo) {
241-
PMIx_Data_pack(NULL, relay, info, ninfo, PMIX_INFO);
259+
rc = PMIx_Data_pack(NULL, relay, info, ninfo, PMIX_INFO);
260+
if (PMIX_SUCCESS != rc) {
261+
PMIX_ERROR_LOG(rc);
262+
PMIX_DATA_BUFFER_RELEASE(relay);
263+
PMIX_DESTRUCT(&sig);
264+
goto error;
265+
}
242266
}
243267
PMIX_DATA_ARRAY_DESTRUCT(&darray);
244268
}
@@ -298,7 +322,7 @@ void prte_grpcomm_direct_grp_recv(int status, pmix_proc_t *sender,
298322
prte_namelist_t *nm;
299323
pmix_data_array_t darray;
300324
pmix_status_t st;
301-
pmix_info_t *info = NULL, *endpts, *grpinfo;
325+
pmix_info_t *info = NULL, *endpts, *grpinfo = NULL;
302326
prte_grpcomm_direct_group_signature_t *sig = NULL;
303327
pmix_data_buffer_t *reply;
304328
prte_grpcomm_group_t *coll;
@@ -386,7 +410,9 @@ void prte_grpcomm_direct_grp_recv(int status, pmix_proc_t *sender,
386410
rc = PMIx_Data_unpack(NULL, buffer, &nendpts, &cnt, PMIX_SIZE);
387411
if (PMIX_SUCCESS != rc) {
388412
PMIX_ERROR_LOG(rc);
389-
PMIX_INFO_FREE(grpinfo, ngrpinfo);
413+
if (NULL != grpinfo) {
414+
PMIX_INFO_FREE(grpinfo, ngrpinfo);
415+
}
390416
PMIX_RELEASE(sig);
391417
return;
392418
}
@@ -396,7 +422,9 @@ void prte_grpcomm_direct_grp_recv(int status, pmix_proc_t *sender,
396422
rc = PMIx_Data_unpack(NULL, buffer, endpts, &cnt, PMIX_INFO);
397423
if (PMIX_SUCCESS != rc) {
398424
PMIX_ERROR_LOG(rc);
399-
PMIX_INFO_FREE(grpinfo, ngrpinfo);
425+
if (NULL != grpinfo) {
426+
PMIX_INFO_FREE(grpinfo, ngrpinfo);
427+
}
400428
PMIX_INFO_FREE(endpts, nendpts);
401429
PMIX_RELEASE(sig);
402430
return;

src/mca/odls/base/odls_base_default_fns.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,6 +2151,11 @@ int prte_odls_base_default_restart_proc(prte_proc_t *child,
21512151
child->rml_uri = NULL;
21522152
}
21532153
app = (prte_app_context_t *) pmix_pointer_array_get_item(jobdat->apps, child->app_idx);
2154+
if (NULL == app) {
2155+
PRTE_ERROR_LOG(PRTE_ERR_NOT_FOUND);
2156+
rc = PRTE_ERR_NOT_FOUND;
2157+
goto CLEANUP;
2158+
}
21542159

21552160
/* setup the path */
21562161
if (PRTE_SUCCESS != (rc = setup_path(app, &wdir))) {

src/mca/odls/base/odls_base_frame.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,9 @@ static int prte_odls_base_open(pmix_mca_base_open_flag_t flags)
252252
prte_odls_globals.xtermcmd = NULL;
253253

254254
/* ensure that SIGCHLD is unblocked as we need to capture it */
255-
if (0 != sigemptyset(&unblock)) {
256-
return PRTE_ERROR;
257-
}
258-
if (0 != sigaddset(&unblock, SIGCHLD)) {
259-
return PRTE_ERROR;
260-
}
255+
sigemptyset(&unblock);
256+
sigaddset(&unblock, SIGCHLD);
257+
261258
if (0 != sigprocmask(SIG_UNBLOCK, &unblock, NULL)) {
262259
return PRTE_ERR_NOT_SUPPORTED;
263260
}

src/mca/ras/pbs/ras_pbs_module.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ static int discover(pmix_list_t *nodelist, char *pbs_jobid)
195195
if (prte_mca_ras_pbs_component.smp_mode) {
196196
/* this cannot happen in smp mode */
197197
pmix_show_help("help-ras-pbs.txt", "smp-multi", true);
198+
fclose(fp);
199+
free(hostname);
198200
return PRTE_ERR_BAD_PARAM;
199201
}
200202
++node->slots;

src/mca/rmaps/round_robin/rmaps_rr_mappers.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,8 @@ int prte_rmaps_rr_byobj(prte_job_t *jdata, prte_app_context_t *app,
665665
if (!prte_rmaps_base_check_avail(jdata, app, node, node_list, obj, options)) {
666666
rc = PRTE_ERR_OUT_OF_RESOURCE;
667667
PRTE_ERROR_LOG(rc);
668-
continue;
668+
// out of resources on this node
669+
break;
669670
}
670671

671672
proc = prte_rmaps_base_setup_proc(jdata, app->idx, node, obj, options);

src/mca/schizo/base/schizo_base_frame.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -726,12 +726,12 @@ int prte_schizo_base_parse_output(pmix_cli_item_t *opt, void *jinfo)
726726

727727
} else if (PMIX_CHECK_CLI_OPTION(options[m], PRTE_CLI_RAW)) {
728728
PMIX_INFO_LIST_ADD(ret, jinfo, PMIX_IOF_OUTPUT_RAW, NULL, PMIX_BOOL);
729-
}
730-
if (PMIX_SUCCESS != ret) {
731-
PMIX_ERROR_LOG(ret);
732-
PMIX_ARGV_FREE_COMPAT(targv);
733-
PMIX_ARGV_FREE_COMPAT(options);
734-
return ret;
729+
if (PMIX_SUCCESS != ret) {
730+
PMIX_ERROR_LOG(ret);
731+
PMIX_ARGV_FREE_COMPAT(targv);
732+
PMIX_ARGV_FREE_COMPAT(options);
733+
return ret;
734+
}
735735
}
736736
}
737737
PMIX_ARGV_FREE_COMPAT(options);

src/prted/pmix/pmix_server.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,11 +1483,17 @@ static void pmix_server_dmdx_recv(int status, pmix_proc_t *sender,
14831483
if (NULL == proc) {
14841484
/* this is truly an error, so notify the sender */
14851485
send_error(PRTE_ERR_NOT_FOUND, &pproc, sender, index);
1486+
if (NULL != key) {
1487+
free(key);
1488+
}
14861489
return;
14871490
}
14881491
if (!PRTE_FLAG_TEST(proc, PRTE_PROC_FLAG_LOCAL)) {
14891492
/* send back an error - they obviously have made a mistake */
14901493
send_error(PRTE_ERR_NOT_FOUND, &pproc, sender, index);
1494+
if (NULL != key) {
1495+
free(key);
1496+
}
14911497
return;
14921498
}
14931499

src/rml/oob/oob_base_stubs.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* reserved.
55
* Copyright (c) 2013-2020 Intel, Inc. All rights reserved.
66
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
7-
* Copyright (c) 2021-2024 Nanook Consulting All rights reserved.
7+
* Copyright (c) 2021-2025 Nanook Consulting All rights reserved.
88
* $COPYRIGHT$
99
*
1010
* Additional copyrights may follow
@@ -218,6 +218,12 @@ void prte_oob_base_get_addr(char **uri)
218218
}
219219
#endif // PRTE_ENABLE_IPV6
220220

221+
if (NULL == cptr) {
222+
PRTE_ERROR_LOG(PRTE_ERR_NOT_FOUND);
223+
*uri = NULL;
224+
return;
225+
}
226+
221227
/* check overall length for limits */
222228
if (0 < prte_oob_base.max_uri_length
223229
&& prte_oob_base.max_uri_length < (int) (len + strlen(cptr))) {

src/util/attr.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -632,11 +632,7 @@ int prte_attr_load(prte_attribute_t *kv, void *data, pmix_data_type_t type)
632632
if (NULL != kv->data.data.string) {
633633
free(kv->data.data.string);
634634
}
635-
if (NULL != data) {
636-
kv->data.data.string = strdup((const char *) data);
637-
} else {
638-
kv->data.data.string = NULL;
639-
}
635+
kv->data.data.string = strdup((const char *) data);
640636
break;
641637
case PMIX_SIZE:
642638
kv->data.data.size = *(size_t *) (data);

0 commit comments

Comments
 (0)