Skip to content

Commit 2f4e532

Browse files
committed
coll/base: fix coverity issues
Fix CID 1325868 (#1 of 1): Dereference after null check (FORWARD_NULL): Fix CID 1325869 (#1-2 of 2): Dereference after null check (FORWARD_NULL): Here reqs can indeed be NULL. Added a check to ompi_coll_base_free_reqs to prevent dereferencing NULL pointer. Signed-off-by: Nathan Hjelm <[email protected]>
1 parent 2ed4501 commit 2f4e532

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ompi/mca/coll/base/coll_base_functions.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* All rights reserved.
1313
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
1414
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
15-
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
15+
* Copyright (c) 2013-2016 Los Alamos National Security, LLC. All rights
1616
* reserved.
1717
* Copyright (c) 2015 Research Organization for Information Science
1818
* and Technology (RIST). All rights reserved.
@@ -352,8 +352,11 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_coll_base_comm_t);
352352
*/
353353
static inline void ompi_coll_base_free_reqs(ompi_request_t **reqs, int count)
354354
{
355-
int i;
356-
for (i = 0; i < count; ++i) {
355+
if (OPAL_UNLIKELY(NULL == reqs)) {
356+
return;
357+
}
358+
359+
for (int i = 0; i < count; ++i) {
357360
if( MPI_REQUEST_NULL != reqs[i] ) {
358361
ompi_request_free(&reqs[i]);
359362
}

0 commit comments

Comments
 (0)