Skip to content

Commit 32a9c0e

Browse files
authored
MPI_T_pvar_session_free() should reject null sessions and set *session to MPI_T_PVAR_SESSION_NULL
1 parent a722be2 commit 32a9c0e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

ompi/mpi/tool/pvar_session_free.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,19 @@
2323

2424
int MPI_T_pvar_session_free(MPI_T_pvar_session *session)
2525
{
26+
int ret = MPI_SUCCESS;
27+
2628
if (!mpit_is_initialized ()) {
2729
return MPI_T_ERR_NOT_INITIALIZED;
2830
}
2931

30-
if (NULL != *session) {
32+
/* Check that this is a valid session */
33+
if (MPI_T_PVAR_SESSION_NULL == *session) {
34+
ret = MPI_T_ERR_INVALID_SESSION;
35+
} else {
3136
OBJ_RELEASE(*session);
32-
*session = NULL;
37+
*session = MPI_T_PVAR_SESSION_NULL;
3338
}
3439

35-
return MPI_SUCCESS;
40+
return ret;
3641
}

0 commit comments

Comments
 (0)