mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-15 23:55:03 +03:00
Fix memory leaks on the collections/variables management
This commit is contained in:
parent
49fc1f8b79
commit
e346454374
@ -40,6 +40,7 @@ class Variables :
|
|||||||
public std::unordered_multimap<std::string, std::string> {
|
public std::unordered_multimap<std::string, std::string> {
|
||||||
public:
|
public:
|
||||||
Variables();
|
Variables();
|
||||||
|
~Variables();
|
||||||
void store(std::string key, std::string value);
|
void store(std::string key, std::string value);
|
||||||
|
|
||||||
bool storeOrUpdateFirst(const std::string &key,
|
bool storeOrUpdateFirst(const std::string &key,
|
||||||
|
@ -37,7 +37,12 @@ Collections::Collections() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Collections::~Collections() { }
|
Collections::~Collections() {
|
||||||
|
for (auto &a : *this) {
|
||||||
|
this->erase(a.first);
|
||||||
|
delete a.second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Collections::init(const std::string& name, const std::string& key) {
|
void Collections::init(const std::string& name, const std::string& key) {
|
||||||
|
@ -148,10 +148,6 @@ Transaction::~Transaction() {
|
|||||||
m_requestBody.str(std::string());
|
m_requestBody.str(std::string());
|
||||||
m_requestBody.clear();
|
m_requestBody.clear();
|
||||||
|
|
||||||
for (auto &a : m_collections) {
|
|
||||||
delete a.second;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_rules->decrementReferenceCount();
|
m_rules->decrementReferenceCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,11 @@ Variables::Variables() {
|
|||||||
this->reserve(1000);
|
this->reserve(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Variables::~Variables() {
|
||||||
|
for (auto &a : *this) {
|
||||||
|
this->erase(a.first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Variables::store(std::string key, std::string value) {
|
void Variables::store(std::string key, std::string value) {
|
||||||
this->emplace(key, value);
|
this->emplace(key, value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user