mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 11:44:32 +03:00
Removes some memory leaks
This commit is contained in:
@@ -87,16 +87,18 @@ bool Pm::evaluate(Assay *assay, const std::string &input) {
|
||||
|
||||
bool Pm::init(const std::string &file, const char **error) {
|
||||
std::vector<std::string> vec;
|
||||
std::istringstream *iss;
|
||||
|
||||
replaceAll(param, "\\", "\\\\");
|
||||
|
||||
char *content = parse_pm_content(param.c_str(), param.length(), error);
|
||||
if (content == NULL) {
|
||||
return false;
|
||||
iss = new std::istringstream(param);
|
||||
} else {
|
||||
iss = new std::istringstream(content);
|
||||
}
|
||||
|
||||
std::istringstream iss(param);
|
||||
std::copy(std::istream_iterator<std::string>(iss),
|
||||
std::copy(std::istream_iterator<std::string>(*iss),
|
||||
std::istream_iterator<std::string>(),
|
||||
back_inserter(vec));
|
||||
|
||||
@@ -106,6 +108,13 @@ bool Pm::init(const std::string &file, const char **error) {
|
||||
|
||||
acmp_prepare(m_p);
|
||||
|
||||
if (content) {
|
||||
free(content);
|
||||
content = NULL;
|
||||
}
|
||||
|
||||
delete iss;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user