[Fix] Repair a EQEMUConfig Memory Leak (#4584)

Co-authored-by: Mitch Freeman <neckkola@gmail.com>
This commit is contained in:
Mitch Freeman 2025-01-06 01:45:28 -04:00 committed by GitHub
parent b40e4ce7cd
commit 33db85f2ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View File

@ -137,9 +137,9 @@ class EQEmuConfig
{
}
virtual ~EQEmuConfig() {}
public:
virtual ~EQEmuConfig() {}
// Produce a const singleton
static const EQEmuConfig *get()

View File

@ -43,11 +43,13 @@ class ZoneConfig : public EQEmuConfig {
}
// Load the config
static bool LoadConfig(const std::string& path = "") {
if (_zone_config != nullptr)
delete _zone_config;
_zone_config=new ZoneConfig;
_config=_zone_config;
static bool LoadConfig(const std::string &path = "")
{
safe_delete(_zone_config);
safe_delete(_config);
_zone_config = new ZoneConfig;
_config = _zone_config;
return _config->parseFile(path);
}