Skip to content

Commit 44dee9a

Browse files
committed
properly release errcode object and skip NULL on finalize
Signed-off-by: Thomas Naughton <[email protected]>
1 parent 6d3ee24 commit 44dee9a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

ompi/errhandler/errcode.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,8 @@ int ompi_mpi_errcode_finalize (void)
280280
* we have to free.
281281
*/
282282
errc = (ompi_mpi_errcode_t *)opal_pointer_array_get_item(&ompi_mpi_errcodes, i);
283-
OBJ_RELEASE (errc);
283+
if (NULL != errc)
284+
OBJ_RELEASE (errc);
284285
}
285286

286287
OBJ_DESTRUCT(&ompi_success);
@@ -448,6 +449,11 @@ int ompi_mpi_errcode_remove(int errnum)
448449

449450
opal_mutex_unlock(&errcode_lock);
450451

452+
/* Release the object on success */
453+
if (ret >= 0) {
454+
OBJ_RELEASE(errcodep);
455+
}
456+
451457
/*
452458
* Return lastused value captured under lock so caller has
453459
* consistent value to set MPI_LASTUSEDCODE attribute.
@@ -487,6 +493,11 @@ int ompi_mpi_errclass_remove(int errclass)
487493

488494
opal_mutex_unlock(&errcode_lock);
489495

496+
/* Release the object on success */
497+
if (ret >= 0) {
498+
OBJ_RELEASE(errcodep);
499+
}
500+
490501
/*
491502
* Return lastused value captured under lock so caller has
492503
* consistent value to set MPI_LASTUSEDCODE attribute.

0 commit comments

Comments
 (0)