Skip to content

Commit ed703be

Browse files
committed
fortran/mpif-h: fix [i]alltoallw bindings
Fix a regression introduced in cdaed89 Fixes CID 1451610, 1451611 and 1451612 Signed-off-by: Gilles Gouaillardet <[email protected]>
1 parent 41c2007 commit ed703be

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

ompi/mpi/fortran/mpif-h/alltoallw_f.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void ompi_alltoallw_f(char *sendbuf, MPI_Fint *sendcounts,
7575
MPI_Fint *comm, MPI_Fint *ierr)
7676
{
7777
MPI_Comm c_comm;
78-
MPI_Datatype *c_sendtypes, *c_recvtypes;
78+
MPI_Datatype *c_sendtypes = NULL, *c_recvtypes;
7979
int size, c_ierr;
8080
OMPI_ARRAY_NAME_DECL(sendcounts);
8181
OMPI_ARRAY_NAME_DECL(sdispls);
@@ -119,7 +119,7 @@ void ompi_alltoallw_f(char *sendbuf, MPI_Fint *sendcounts,
119119
OMPI_ARRAY_FINT_2_INT_CLEANUP(sdispls);
120120
OMPI_ARRAY_FINT_2_INT_CLEANUP(recvcounts);
121121
OMPI_ARRAY_FINT_2_INT_CLEANUP(rdispls);
122-
if (MPI_IN_PLACE != sendbuf) {
122+
if (NULL != c_sendtypes) {
123123
free(c_sendtypes);
124124
}
125125
free(c_recvtypes);

ompi/mpi/fortran/mpif-h/ialltoallw_f.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void ompi_ialltoallw_f(char *sendbuf, MPI_Fint *sendcounts,
7575
MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr)
7676
{
7777
MPI_Comm c_comm;
78-
MPI_Datatype *c_sendtypes, *c_recvtypes;
78+
MPI_Datatype *c_sendtypes = NULL, *c_recvtypes;
7979
MPI_Request c_request;
8080
int size, c_ierr;
8181
OMPI_ARRAY_NAME_DECL(sendcounts);
@@ -101,7 +101,6 @@ void ompi_ialltoallw_f(char *sendbuf, MPI_Fint *sendcounts,
101101
for (int i=0; i<size; i++) {
102102
c_recvtypes[i] = PMPI_Type_f2c(recvtypes[i]);
103103
}
104-
c_recvtypes = (MPI_Datatype *) malloc(size * sizeof(MPI_Datatype));
105104

106105
sendbuf = (char *) OMPI_F2C_IN_PLACE(sendbuf);
107106
sendbuf = (char *) OMPI_F2C_BOTTOM(sendbuf);
@@ -122,7 +121,7 @@ void ompi_ialltoallw_f(char *sendbuf, MPI_Fint *sendcounts,
122121
OMPI_ARRAY_FINT_2_INT_CLEANUP(sdispls);
123122
OMPI_ARRAY_FINT_2_INT_CLEANUP(recvcounts);
124123
OMPI_ARRAY_FINT_2_INT_CLEANUP(rdispls);
125-
if (MPI_IN_PLACE != sendbuf) {
124+
if (NULL != c_sendtypes) {
126125
free(c_sendtypes);
127126
}
128127
free(c_recvtypes);

0 commit comments

Comments
 (0)