Skip to content

Commit 1aa8cb9

Browse files
committed
attribute: Fix error handling in constructor
Don't use assert to check return values in this (not performance critical) code, but always check and abort on failure. Fixes a warning about unread variable, but also is the right way to handle error checking. Signed-off-by: Brian Barrett <bbarrett@amazon.com>
1 parent 743e190 commit 1aa8cb9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

ompi/attribute/attribute.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,9 @@ static void attr_subsys_construct(attr_subsys_t *subsys)
594594
opal_bitmap_set_max_size (subsys->key_bitmap,
595595
OMPI_FORTRAN_HANDLE_MAX);
596596
ret = opal_bitmap_init(subsys->key_bitmap, 32);
597-
assert(OPAL_SUCCESS == ret);
597+
if (OPAL_SUCCESS != ret) {
598+
abort();
599+
}
598600

599601
for (int i = 0; i < MPI_ATTR_PREDEFINED_KEY_MAX; i++) {
600602
opal_bitmap_set_bit(subsys->key_bitmap, i);
@@ -615,9 +617,11 @@ static void attr_subsys_construct(attr_subsys_t *subsys)
615617
}
616618

617619
ret = opal_hash_table_init(subsys->keyval_hash, ATTR_TABLE_SIZE);
618-
assert (OPAL_SUCCESS == ret);
620+
if (OPAL_SUCCESS != ret) {
621+
abort();
622+
}
619623

620-
attr_sequence = 0;
624+
attr_sequence = 0;
621625
}
622626

623627

0 commit comments

Comments
 (0)