mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-15 23:55:03 +03:00
Avoids to cleanup GeoIp on ModSecurity destructor
GeoIp is already being cleaned elsewhere. Fix #2041
This commit is contained in:
parent
d242f0cd54
commit
ec7d2db400
2
CHANGES
2
CHANGES
@ -1,6 +1,8 @@
|
|||||||
v3.x.y - YYYY-MMM-DD (to be released)
|
v3.x.y - YYYY-MMM-DD (to be released)
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
|
||||||
|
- Avoids to cleanup GeoIp on ModSecurity destructor
|
||||||
|
[#2041 - @zimmerle, @jptosso, @victorhora]
|
||||||
- Fix memory leak of RuleMessages objects
|
- Fix memory leak of RuleMessages objects
|
||||||
[#2376 - @WGH-, @martinhsv]
|
[#2376 - @WGH-, @martinhsv]
|
||||||
- Produce not-supported error for ctl:forceRequestBodyVariable
|
- Produce not-supported error for ctl:forceRequestBodyVariable
|
||||||
|
@ -95,9 +95,6 @@ ModSecurity::~ModSecurity() {
|
|||||||
#ifdef MSC_WITH_CURL
|
#ifdef MSC_WITH_CURL
|
||||||
curl_global_cleanup();
|
curl_global_cleanup();
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_GEOIP
|
|
||||||
Utils::GeoLookup::getInstance().cleanUp();
|
|
||||||
#endif
|
|
||||||
#ifdef WITH_LIBXML2
|
#ifdef WITH_LIBXML2
|
||||||
xmlCleanupParser();
|
xmlCleanupParser();
|
||||||
#endif
|
#endif
|
||||||
|
@ -63,22 +63,26 @@ bool GeoLookup::setDataBase(const std::string& filePath,
|
|||||||
std::string intGeo;
|
std::string intGeo;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (m_version != NOT_LOADED) {
|
||||||
|
cleanUp();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef WITH_MAXMIND
|
#ifdef WITH_MAXMIND
|
||||||
int status = MMDB_open(filePath.c_str(), MMDB_MODE_MMAP, &mmdb);
|
int status = MMDB_open(filePath.c_str(), MMDB_MODE_MMAP, &mmdb);
|
||||||
if (status != MMDB_SUCCESS) {
|
if (status == MMDB_SUCCESS) {
|
||||||
intMax.assign("libMaxMind: Can't open: " + std::string(MMDB_strerror(status)) + ".");
|
|
||||||
} else {
|
|
||||||
m_version = VERSION_MAXMIND;
|
m_version = VERSION_MAXMIND;
|
||||||
|
} else {
|
||||||
|
intMax.assign("libMaxMind: Can't open: " + std::string(MMDB_strerror(status)) + ".");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WITH_GEOIP
|
#ifdef WITH_GEOIP
|
||||||
if (m_version == NOT_LOADED) {
|
if (m_version == NOT_LOADED) {
|
||||||
m_gi = GeoIP_open(filePath.c_str(), GEOIP_MEMORY_CACHE);
|
m_gi = GeoIP_open(filePath.c_str(), GEOIP_MEMORY_CACHE);
|
||||||
if (m_gi == NULL) {
|
if (m_gi) {
|
||||||
intGeo.append("GeoIP: Can't open: " + filePath + ".");
|
|
||||||
} else {
|
|
||||||
m_version = VERSION_GEOIP;
|
m_version = VERSION_GEOIP;
|
||||||
|
} else {
|
||||||
|
intGeo.append("GeoIP: Can't open: " + filePath + ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -55,13 +55,16 @@ class GeoLookup {
|
|||||||
private:
|
private:
|
||||||
GeoLookup() :
|
GeoLookup() :
|
||||||
m_version(NOT_LOADED)
|
m_version(NOT_LOADED)
|
||||||
|
#if WITH_MAXMIND
|
||||||
|
,mmdb()
|
||||||
|
#endif
|
||||||
#if WITH_GEOIP
|
#if WITH_GEOIP
|
||||||
,m_gi(NULL)
|
,m_gi(NULL)
|
||||||
#endif
|
#endif
|
||||||
{ }
|
{ }
|
||||||
~GeoLookup();
|
~GeoLookup();
|
||||||
GeoLookup(GeoLookup const&);
|
GeoLookup(GeoLookup const&) = delete;
|
||||||
void operator=(GeoLookup const&);
|
void operator=(GeoLookup const&) = delete;
|
||||||
|
|
||||||
GeoLookupVersion m_version;
|
GeoLookupVersion m_version;
|
||||||
#if WITH_MAXMIND
|
#if WITH_MAXMIND
|
||||||
|
@ -51,14 +51,14 @@ functionStatic:src/engine/lua.h:80
|
|||||||
functionConst:src/utils/geo_lookup.h:49
|
functionConst:src/utils/geo_lookup.h:49
|
||||||
useInitializationList:src/operators/rbl.h:69
|
useInitializationList:src/operators/rbl.h:69
|
||||||
constStatement:test/common/modsecurity_test.cc:82
|
constStatement:test/common/modsecurity_test.cc:82
|
||||||
danglingTemporaryLifetime:src/modsecurity.cc:204
|
danglingTemporaryLifetime:src/modsecurity.cc:201
|
||||||
functionStatic:src/operators/geo_lookup.h:35
|
functionStatic:src/operators/geo_lookup.h:35
|
||||||
duplicateBreak:src/operators/validate_utf8_encoding.cc
|
duplicateBreak:src/operators/validate_utf8_encoding.cc
|
||||||
duplicateBranch:src/request_body_processor/multipart.cc:91
|
duplicateBranch:src/request_body_processor/multipart.cc:91
|
||||||
syntaxError:src/transaction.cc:62
|
syntaxError:src/transaction.cc:62
|
||||||
noConstructor:src/variables/variable.h:152
|
noConstructor:src/variables/variable.h:152
|
||||||
duplicateBranch:src/request_body_processor/multipart.cc:93
|
duplicateBranch:src/request_body_processor/multipart.cc:93
|
||||||
danglingTempReference:src/modsecurity.cc:204
|
danglingTempReference:src/modsecurity.cc:201
|
||||||
knownConditionTrueFalse:src/operators/validate_url_encoding.cc:79
|
knownConditionTrueFalse:src/operators/validate_url_encoding.cc:79
|
||||||
knownConditionTrueFalse:src/operators/verify_svnr.cc:90
|
knownConditionTrueFalse:src/operators/verify_svnr.cc:90
|
||||||
noConstructor:src/actions/rule_id.h:30
|
noConstructor:src/actions/rule_id.h:30
|
||||||
|
Loading…
x
Reference in New Issue
Block a user