mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-10-01 03:57:47 +03:00
Fix memory leak in @fuzzyHash
This commit is contained in:
@@ -84,6 +84,17 @@ bool FuzzyHash::init(const std::string ¶m2, std::string *error) {
|
|||||||
#endif
|
#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) {
|
bool FuzzyHash::evaluate(Transaction *t, const std::string &str) {
|
||||||
|
@@ -29,7 +29,7 @@ namespace operators {
|
|||||||
|
|
||||||
|
|
||||||
struct fuzzy_hash_chunk {
|
struct fuzzy_hash_chunk {
|
||||||
const char *data;
|
char *data;
|
||||||
struct fuzzy_hash_chunk *next;
|
struct fuzzy_hash_chunk *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -44,6 +44,8 @@ class FuzzyHash : public Operator {
|
|||||||
: Operator("FuzzyHash", param),
|
: Operator("FuzzyHash", param),
|
||||||
m_head(NULL),
|
m_head(NULL),
|
||||||
m_threshold(0) { }
|
m_threshold(0) { }
|
||||||
|
~FuzzyHash();
|
||||||
|
|
||||||
bool evaluate(Transaction *transaction, const std::string &std) override;
|
bool evaluate(Transaction *transaction, const std::string &std) override;
|
||||||
|
|
||||||
bool init(const std::string ¶m, std::string *error) override;
|
bool init(const std::string ¶m, std::string *error) override;
|
||||||
|
Reference in New Issue
Block a user