mirror of
https://github.com/monero-project/monero.git
synced 2024-12-29 10:26:13 -05:00
easylogging++: fix potential memory corruption
The m_typedConfigurations pointer is copied from one object to the next, but deleted in the dtor, leading to potential double free. It is also deleted first thing in the copy ctor, deleting uninitialized memory. This does not seem to actually happen in practice (those functions do not get called), but seems safer that way. Coverity 1446562
This commit is contained in:
parent
cb70ae9450
commit
8889f490ce
5
external/easylogging++/easylogging++.cc
vendored
5
external/easylogging++/easylogging++.cc
vendored
@ -713,9 +713,8 @@ Logger::Logger(const std::string& id, const Configurations& configurations,
|
||||
}
|
||||
|
||||
Logger::Logger(const Logger& logger) {
|
||||
base::utils::safeDelete(m_typedConfigurations);
|
||||
m_id = logger.m_id;
|
||||
m_typedConfigurations = logger.m_typedConfigurations;
|
||||
m_typedConfigurations = logger.m_typedConfigurations ? new base::TypedConfigurations(*logger.m_typedConfigurations) : nullptr;
|
||||
m_parentApplicationName = logger.m_parentApplicationName;
|
||||
m_isConfigured = logger.m_isConfigured;
|
||||
m_configurations = logger.m_configurations;
|
||||
@ -727,7 +726,7 @@ Logger& Logger::operator=(const Logger& logger) {
|
||||
if (&logger != this) {
|
||||
base::utils::safeDelete(m_typedConfigurations);
|
||||
m_id = logger.m_id;
|
||||
m_typedConfigurations = logger.m_typedConfigurations;
|
||||
m_typedConfigurations = logger.m_typedConfigurations ? new base::TypedConfigurations(*logger.m_typedConfigurations) : nullptr;
|
||||
m_parentApplicationName = logger.m_parentApplicationName;
|
||||
m_isConfigured = logger.m_isConfigured;
|
||||
m_configurations = logger.m_configurations;
|
||||
|
Loading…
Reference in New Issue
Block a user