Skip to content

Commit

Permalink
coll/base: fix coverity issues
Browse files Browse the repository at this point in the history
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 <hjelmn@lanl.gov>
  • Loading branch information
hjelmn committed Mar 18, 2016
1 parent 2ed4501 commit 2f4e532
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ompi/mca/coll/base/coll_base_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* All rights reserved.
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* Copyright (c) 2013-2016 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
Expand Down Expand Up @@ -352,8 +352,11 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_coll_base_comm_t);
*/
static inline void ompi_coll_base_free_reqs(ompi_request_t **reqs, int count)
{
int i;
for (i = 0; i < count; ++i) {
if (OPAL_UNLIKELY(NULL == reqs)) {
return;
}

for (int i = 0; i < count; ++i) {
if( MPI_REQUEST_NULL != reqs[i] ) {
ompi_request_free(&reqs[i]);
}
Expand Down

0 comments on commit 2f4e532

Please sign in to comment.