From 6afdc9fb5fa37639bcec6da8aa3186f928206cdc Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Sun, 20 Aug 2017 17:21:06 +0200 Subject: [PATCH] AVLs: Added an error check --- src/obiavl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/obiavl.c b/src/obiavl.c index dc1b58d..264ece6 100644 --- a/src/obiavl.c +++ b/src/obiavl.c @@ -2463,7 +2463,7 @@ index_t obi_avl_group_add(OBIDMS_avl_group_p avl_group, Obi_blob_p value) // Check if the AVL group is writable if (!(avl_group->writable)) { - obi_set_errno(OBI_READ_ONLY_INDEXER_ERROR); + obi_set_errno(OBI_READ_ONLY_INDEXER_ERROR); // Note: this error is read by the calling functions to clone the AVL group if needed return -1; } @@ -2476,7 +2476,10 @@ index_t obi_avl_group_add(OBIDMS_avl_group_p avl_group, Obi_blob_p value) // Add in the current AVL index_in_avl = (int32_t) obi_avl_add((avl_group->sub_avls)[avl_group->last_avl_idx], value); - bloom_add(&((((avl_group->sub_avls)[avl_group->last_avl_idx])->header)->bloom_filter), value, obi_blob_sizeof(value)); + if (index_in_avl < 0) + return -1; + + bloom_add(&((((avl_group->sub_avls)[avl_group->last_avl_idx])->header)->bloom_filter), value, obi_blob_sizeof(value)) // Build the index containing the AVL index index_with_avl = avl_group->last_avl_idx;