Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Fix valgrind warnings.

Kishore Nallan910256d82cbf
diff --git a/src/index.cpp b/src/index.cpp
index 871d0390..28135bc5 100644
--- a/src/index.cpp
+++ b/src/index.cpp
@@ -1326,7 +1326,7 @@ uint32_t Index::do_filtering(uint32_t** filter_ids_out, const std::vector<filter
}
}
- uint32_t* excluded_strt_ids = new uint32_t[strt_ids_size];
+ uint32_t* excluded_strt_ids = nullptr;
size_t excluded_strt_size = 0;
excluded_strt_size = ArrayUtils::exclude_scalar(ids, ids_size, strt_ids,
strt_ids_size, &excluded_strt_ids);
@@ -1338,7 +1338,7 @@ uint32_t Index::do_filtering(uint32_t** filter_ids_out, const std::vector<filter
ids = excluded_strt_ids;
ids_size = excluded_strt_size;
-
+ delete[] strt_ids;
} else {
// Otherwise, we just ensure that given record contains tokens in the filter query
uint32_t* out = nullptr;
diff --git a/test/collection_manager_test.cpp b/test/collection_manager_test.cpp
index edc11c58..7361f9c2 100644
--- a/test/collection_manager_test.cpp
+++ b/test/collection_manager_test.cpp
@@ -549,6 +549,7 @@ TEST_F(CollectionManagerTest, Symlinking) {
TEST_F(CollectionManagerTest, LoadMultipleCollections) {
// to prevent fixture tear down from running as we are fudging with CollectionManager singleton
+ collectionManager.dispose();
delete store;
store = nullptr;
diff --git a/test/posting_list_test.cpp b/test/posting_list_test.cpp
index 870b70ba..d28db670 100644
--- a/test/posting_list_test.cpp
+++ b/test/posting_list_test.cpp
@@ -1338,6 +1338,9 @@ TEST_F(PostingListTest, CompactToFullPostingListConversion) {
ASSERT_EQ(4, c1->num_ids());
ASSERT_EQ(4, p1->num_ids());
+
+ free(c1);
+ delete p1;
}
TEST_F(PostingListTest, BlockIntersectionOnMixedLists) {