Skip to content

Commit 331a547

Browse files
authored
Merge pull request #13334 from hppritcha/cid_fixes_16959066_and_more
coverity: fix cids 1659066 and 1659065
2 parents a471c74 + 58c9a08 commit 331a547

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

ompi/mpi/bindings/ompi_bindings/fortran_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def declare(self):
225225
if self.bigcount:
226226
return f'INTEGER(KIND=MPI_COUNT_KIND), INTENT(OUT) :: {self.name}'
227227
else:
228-
return f'INTEGER, INTENT(IN) :: {self.name}'
228+
return f'INTEGER, INTENT(OUT) :: {self.name}'
229229

230230
def use(self):
231231
return [('mpi_f08_types', 'MPI_COUNT_KIND')]

ompi/mpi/fortran/use-mpi-f08/alltoallw_ts.c.in

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ PROTOTYPE VOID alltoallw(BUFFER x1, COUNT_ARRAY sendcounts,
3030
int size, c_ierr;
3131
MPI_Comm c_comm = PMPI_Comm_f2c(*comm);
3232
char *sendbuf = OMPI_CFI_BASE_ADDR(x1), *recvbuf = OMPI_CFI_BASE_ADDR(x2);
33-
MPI_Datatype *c_sendtypes = NULL, *c_recvtypes;
33+
MPI_Datatype *c_sendtypes = NULL, *c_recvtypes = NULL;
3434
@COUNT_TYPE@ *tmp_sendcounts = NULL;
3535
@DISP_TYPE@ *tmp_sdispls = NULL;
3636
@COUNT_TYPE@ *tmp_recvcounts = NULL;
@@ -59,7 +59,7 @@ PROTOTYPE VOID alltoallw(BUFFER x1, COUNT_ARRAY sendcounts,
5959
if (MPI_SUCCESS != c_ierr) {
6060
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
6161
OMPI_ERRHANDLER_INVOKE(c_comm, c_ierr, FUNC_NAME)
62-
return;
62+
goto fn_exit;
6363
}
6464

6565
c_recvtypes = (MPI_Datatype *) malloc(size * sizeof(MPI_Datatype));
@@ -84,6 +84,7 @@ PROTOTYPE VOID alltoallw(BUFFER x1, COUNT_ARRAY sendcounts,
8484
c_recvtypes, c_comm);
8585
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
8686

87+
fn_exit:
8788
OMPI_FORTRAN_BIGCOUNT_ARRAY_CLEANUP(sendcounts, tmp_sendcounts);
8889
OMPI_FORTRAN_BIGCOUNT_ARRAY_CLEANUP(sdispls, tmp_sdispls);
8990
OMPI_FORTRAN_BIGCOUNT_ARRAY_CLEANUP(recvcounts, tmp_recvcounts);
@@ -92,5 +93,7 @@ PROTOTYPE VOID alltoallw(BUFFER x1, COUNT_ARRAY sendcounts,
9293
if (NULL != c_sendtypes) {
9394
free(c_sendtypes);
9495
}
95-
free(c_recvtypes);
96+
if (NULL != c_recvtypes) {
97+
free(c_recvtypes);
98+
}
9699
}

ompi/mpi/fortran/use-mpi-f08/get_count.c.in

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@
2121
* $HEADER$
2222
*/
2323

24-
PROTOTYPE VOID get_count(STATUS status, DATATYPE datatype, COUNT count)
24+
PROTOTYPE VOID get_count(STATUS status, DATATYPE datatype, COUNT_OUT count)
2525
{
2626
int c_ierr;
2727
MPI_Datatype c_type = PMPI_Type_f2c(*datatype);
2828
MPI_Status c_status;
29-
@COUNT_TYPE@ c_count;
29+
@COUNT_TYPE@ c_count = 0;
3030

3131
if (OMPI_IS_FORTRAN_STATUS_IGNORE(status)) {
32-
*count = OMPI_INT_2_FINT(0);
3332
c_ierr = MPI_SUCCESS;
3433
} else {
3534
c_ierr = PMPI_Status_f2c(status, &c_status);

0 commit comments

Comments
 (0)