fix memory leak.

This commit is contained in:
Harpreet Sangar 2023-02-09 12:25:16 +05:30
parent b1ef695461
commit 57908965ae

View File

@ -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);
}