Loading src/conf.cpp +26 −13 Original line number Diff line number Diff line Loading @@ -40,8 +40,12 @@ confplus::Config::ConfigValue::ConfigValue(){ _nextValue=nullptr; } confplus::Config::ConfigValue::~ConfigValue(){ delete _nextValue; confplus::Config::ConfigData::~ConfigData(){ if (haveChild && Child) delete Child; if (Value) delete Value; delete nextData; } confplus::Config::ConfigData *confplus::Config::getKey(const char* key) const{ Loading Loading @@ -226,11 +230,12 @@ confplus::Config::Config(const char* path) { confplus::Config::~Config() { destroy_t *destroy_plugin = (destroy_t*)GetProcAddress((HMODULE)_BackendData, "destroy"); if (destroy_plugin == nullptr) { // Log an error if the symbol cannot be found, but continue to unload the library std::cerr << "Cannot load symbol 'destroy': " << GetLastError() << std::endl; } else { if (destroy_plugin != nullptr) { destroy_plugin(_currApi); } else { std::cerr << "Cannot load symbol 'destroy': " << GetLastError() << ". Attempting raw delete." << std::endl; delete _currApi; } if (_BackendData != nullptr) { Loading @@ -240,7 +245,6 @@ confplus::Config::~Config() { delete firstData; } #else confplus::Config::Config(const std::string &path){ firstData=nullptr; Loading Loading @@ -280,16 +284,25 @@ confplus::Config::Config(const std::string &path){ } confplus::Config::~Config(){ const char* dlsym_error = dlerror(); dlerror(); destroy_t* destroy_plugin = (destroy_t*) dlsym(_BackendData, "destroy"); dlsym_error = dlerror(); const char* dlsym_error = dlerror(); if (!dlsym_error && destroy_plugin && _currApi) { destroy_plugin(_currApi); } else { if (dlsym_error) { std::cerr << "Cannot load symbol destroy: " << dlsym_error << std::endl; } else if (!_currApi) { std::cerr << "Cannot destroy plugin: _currApi is NULL." << std::endl; } } destroy_plugin(_currApi); if (_BackendData) { dlclose(_BackendData); _BackendData = nullptr; } delete firstData; } #endif Loading Loading
src/conf.cpp +26 −13 Original line number Diff line number Diff line Loading @@ -40,8 +40,12 @@ confplus::Config::ConfigValue::ConfigValue(){ _nextValue=nullptr; } confplus::Config::ConfigValue::~ConfigValue(){ delete _nextValue; confplus::Config::ConfigData::~ConfigData(){ if (haveChild && Child) delete Child; if (Value) delete Value; delete nextData; } confplus::Config::ConfigData *confplus::Config::getKey(const char* key) const{ Loading Loading @@ -226,11 +230,12 @@ confplus::Config::Config(const char* path) { confplus::Config::~Config() { destroy_t *destroy_plugin = (destroy_t*)GetProcAddress((HMODULE)_BackendData, "destroy"); if (destroy_plugin == nullptr) { // Log an error if the symbol cannot be found, but continue to unload the library std::cerr << "Cannot load symbol 'destroy': " << GetLastError() << std::endl; } else { if (destroy_plugin != nullptr) { destroy_plugin(_currApi); } else { std::cerr << "Cannot load symbol 'destroy': " << GetLastError() << ". Attempting raw delete." << std::endl; delete _currApi; } if (_BackendData != nullptr) { Loading @@ -240,7 +245,6 @@ confplus::Config::~Config() { delete firstData; } #else confplus::Config::Config(const std::string &path){ firstData=nullptr; Loading Loading @@ -280,16 +284,25 @@ confplus::Config::Config(const std::string &path){ } confplus::Config::~Config(){ const char* dlsym_error = dlerror(); dlerror(); destroy_t* destroy_plugin = (destroy_t*) dlsym(_BackendData, "destroy"); dlsym_error = dlerror(); const char* dlsym_error = dlerror(); if (!dlsym_error && destroy_plugin && _currApi) { destroy_plugin(_currApi); } else { if (dlsym_error) { std::cerr << "Cannot load symbol destroy: " << dlsym_error << std::endl; } else if (!_currApi) { std::cerr << "Cannot destroy plugin: _currApi is NULL." << std::endl; } } destroy_plugin(_currApi); if (_BackendData) { dlclose(_BackendData); _BackendData = nullptr; } delete firstData; } #endif Loading