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 memory leak.

Harpreet Sangar515d8d228213
diff --git a/src/collection.cpp b/src/collection.cpp
index 97c8072b..a6172a94 100644
--- a/src/collection.cpp
+++ b/src/collection.cpp
@@ -3862,6 +3862,7 @@ Option<bool> Collection::prune_doc(nlohmann::json& doc,
}
if (documents[0].first == 0) {
+ delete[] documents[0].second;
continue;
}
@@ -3884,6 +3885,8 @@ Option<bool> Collection::prune_doc(nlohmann::json& doc,
reference_docs.push_back(ref_doc);
}
+ delete[] documents[0].second;
+
for (const auto &ref_doc: reference_docs) {
doc.update(ref_doc);
}