mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Handles better the memory utilization
- Added reference counts to Rule and AuditLog; - Some memory leaks were removed, including GeoLookup; - Deal better with parser errors; - Overriding the AutlogLogWritter destructor.
This commit is contained in:
@@ -157,7 +157,7 @@ class Assay {
|
||||
|
||||
int processLogging(int status_code);
|
||||
|
||||
ModSecurityIntervention *intervention();
|
||||
bool intervention(ModSecurityIntervention *it);
|
||||
|
||||
void cleanup();
|
||||
|
||||
@@ -281,7 +281,7 @@ int msc_get_response_body_length(Assay *assay);
|
||||
void msc_assay_cleanup(Assay *assay);
|
||||
|
||||
/** @ingroup ModSecurity_C_API */
|
||||
ModSecurityIntervention *msc_intervention(Assay *assay);
|
||||
int msc_intervention(Assay *assay, ModSecurityIntervention *it);
|
||||
|
||||
/** @ingroup ModSecurity_C_API */
|
||||
int msc_process_logging(Assay *assay, int code);
|
||||
|
@@ -42,7 +42,8 @@ class DebugLog : public std::ofstream {
|
||||
*/
|
||||
DebugLog()
|
||||
: m_is_configured(false),
|
||||
m_debug_level(0) { }
|
||||
m_debug_level(0),
|
||||
m_referenceCount(0) { }
|
||||
|
||||
bool setOutputFile(const std::string& file);
|
||||
virtual bool write_log(int level, const std::string& data);
|
||||
@@ -53,6 +54,9 @@ class DebugLog : public std::ofstream {
|
||||
|
||||
virtual DebugLog *new_instance();
|
||||
|
||||
void refCountDecreaseAndCheck(void);
|
||||
void refCountIncrease(void);
|
||||
|
||||
private:
|
||||
/*
|
||||
ModSecurityDebugLog(ModSecurityDebugLog const&);
|
||||
@@ -60,6 +64,7 @@ class DebugLog : public std::ofstream {
|
||||
*/
|
||||
int m_debug_level;
|
||||
bool m_is_configured;
|
||||
int m_referenceCount;
|
||||
};
|
||||
|
||||
} // namespace ModSecurity
|
||||
|
@@ -49,7 +49,7 @@ class Rules : public RulesProperties {
|
||||
Rules()
|
||||
: RulesProperties(NULL) { }
|
||||
|
||||
Rules(DebugLog *customLog)
|
||||
explicit Rules(DebugLog *customLog)
|
||||
: RulesProperties(customLog) { }
|
||||
|
||||
~Rules();
|
||||
@@ -75,6 +75,7 @@ class Rules : public RulesProperties {
|
||||
std::ostringstream parserError;
|
||||
|
||||
DebugLog *debugLog;
|
||||
|
||||
private:
|
||||
int m_referenceCount;
|
||||
};
|
||||
|
@@ -27,7 +27,6 @@
|
||||
|
||||
#include "modsecurity/modsecurity.h"
|
||||
#include "modsecurity/assay.h"
|
||||
#include "modsecurity/assay.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -61,7 +60,7 @@ class RulesProperties {
|
||||
responseBodyLimitAction(ProcessPartialBodyLimitAction),
|
||||
secRuleEngine(DetectionOnlyRuleEngine) { }
|
||||
|
||||
~RulesProperties() { };
|
||||
~RulesProperties() { }
|
||||
|
||||
std::vector<Rule *> rules[7]; // ModSecurity::Phases::NUMBER_OF_PHASES
|
||||
|
||||
@@ -174,10 +173,7 @@ class RulesProperties {
|
||||
AuditLog *audit_log;
|
||||
|
||||
OnFailedRemoteRulesAction remoteRulesActionOnFailed;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Reference in New Issue
Block a user