Fix memory leak in @fuzzyHash

This commit is contained in:
Felipe Zimmerle
2017-11-13 23:54:30 -03:00
parent 68152d8d29
commit b7698d6899
2 changed files with 14 additions and 1 deletions

View File

@@ -84,6 +84,17 @@ bool FuzzyHash::init(const std::string &param2, std::string *error) {
#endif
}
FuzzyHash::~FuzzyHash() {
struct fuzzy_hash_chunk *c = m_head;
while (c) {
struct fuzzy_hash_chunk *t = c;
free(c->data);
c->data = NULL;
c = c->next;
free (t);
}
m_head = NULL;
}
bool FuzzyHash::evaluate(Transaction *t, const std::string &str) {