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 Sangar57908965ae2f
diff --git a/src/collection.cpp b/src/collection.cpp
index 331669f4..1f27616d 100644
--- a/src/collection.cpp
+++ b/src/collection.cpp
@@ -3857,6 +3857,7 @@ Option<bool> Collection::prune_doc(nlohmann::json& doc,
}
if (documents[0].first == 0) {
+ delete[] documents[0].second;
continue;
}
@@ -3879,6 +3880,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);
}