Skip to content

Commit 1d27b1f

Browse files
committed
pmix/native: fix coverity issue
CID 1269730 Dereference after null check (FORWARD_NULL) The code checked for cb == NULL before checking for a callback function but did not have the same protection around the OBJ_RELEASE(cb). Signed-off-by: Nathan Hjelm <[email protected]>
1 parent 5e2bc2c commit 1d27b1f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

opal/mca/pmix/native/pmix_native.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* and Technology (RIST). All rights reserved.
66
* Copyright (c) 2014 Mellanox Technologies, Inc.
77
* All rights reserved.
8+
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
9+
* reserved.
810
* $COPYRIGHT$
911
*
1012
* Additional copyrights may follow
@@ -699,10 +701,12 @@ static void fencenb_cbfunc(opal_buffer_t *buf, void *cbdata)
699701
}
700702

701703
/* if a callback was provided, execute it */
702-
if (NULL != cb && NULL != cb->cbfunc) {
703-
cb->cbfunc(rc, NULL, cb->cbdata);
704+
if (NULL != cb) {
705+
if (NULL != cb->cbfunc) {
706+
cb->cbfunc(rc, NULL, cb->cbdata);
707+
}
708+
OBJ_RELEASE(cb);
704709
}
705-
OBJ_RELEASE(cb);
706710
}
707711

708712
static int native_fence_nb(opal_process_name_t *procs, size_t nprocs,

0 commit comments

Comments
 (0)