Skip to content

Commit 41ee097

Browse files
authored
Merge pull request #10977 from jjhursey/fix-leak-coll-basic
coll/basic: Fix clang warnings
2 parents 2b7fbb3 + c196e67 commit 41ee097

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

ompi/mca/coll/basic/coll_basic_reduce.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* All rights reserved.
1212
* Copyright (c) 2015 Research Organization for Information Science
1313
* and Technology (RIST). All rights reserved.
14+
* Copyright (c) 2022 IBM Corporation. All rights reserved.
1415
* $COPYRIGHT$
1516
*
1617
* Additional copyrights may follow
@@ -145,6 +146,9 @@ mca_coll_basic_reduce_log_intra(const void *sbuf, void *rbuf, int count,
145146
}
146147
sbuf = inplace_temp - gap;
147148
err = ompi_datatype_copy_content_same_ddt(dtype, count, (char*)sbuf, (char*)rbuf);
149+
if (MPI_SUCCESS != err) {
150+
goto cleanup_and_return;
151+
}
148152
}
149153
snd_buffer = (char*)sbuf;
150154

ompi/mca/coll/basic/coll_basic_reduce_scatter_block.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* Copyright (c) 2012 Sandia National Laboratories. All rights reserved.
1515
* Copyright (c) 2014-2018 Research Organization for Information Science
1616
* and Technology (RIST). All rights reserved.
17+
* Copyright (c) 2022 IBM Corporation. All rights reserved.
1718
* $COPYRIGHT$
1819
*
1920
* Additional copyrights may follow
@@ -104,11 +105,12 @@ mca_coll_basic_reduce_scatter_block_inter(const void *sbuf, void *rbuf, int rcou
104105
if (rank == root) {
105106
span = opal_datatype_span(&dtype->super, totalcounts, &gap);
106107

107-
tmpbuf = (char *) malloc(span);
108-
tmpbuf2 = (char *) malloc(span);
109-
if (NULL == tmpbuf || NULL == tmpbuf2) {
108+
tmpbuf = (char *) malloc(2*span);
109+
if (NULL == tmpbuf) {
110110
return OMPI_ERR_OUT_OF_RESOURCE;
111111
}
112+
tmpbuf2 = tmpbuf + span;
113+
112114
lbuf = tmpbuf - gap;
113115
buf = tmpbuf2 - gap;
114116

ompi/mca/coll/basic/coll_basic_scatterv.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* All rights reserved.
1212
* Copyright (c) 2015-2021 Research Organization for Information Science
1313
* and Technology (RIST). All rights reserved.
14-
* Copyright (c) 2017 IBM Corporation. All rights reserved.
14+
* Copyright (c) 2017-2022 IBM Corporation. All rights reserved.
1515
* $COPYRIGHT$
1616
*
1717
* Additional copyrights may follow
@@ -93,6 +93,9 @@ mca_coll_basic_scatterv_intra(const void *sbuf, const int *scounts,
9393
if (scounts[i] > 0 && MPI_IN_PLACE != rbuf) {
9494
err = ompi_datatype_sndrcv(ptmp, scounts[i], sdtype, rbuf, rcount,
9595
rdtype);
96+
if (MPI_SUCCESS != err) {
97+
return err;
98+
}
9699
}
97100
} else {
98101
/* Only send if there is something to send */

0 commit comments

Comments
 (0)