fix: Solve double-free by letting Log adopt FileLogOutputter in Windows daemon
This commit is contained in:
parent
aa5a704131
commit
66acf9038b
2 changed files with 4 additions and 4 deletions
|
|
@ -203,8 +203,8 @@ void DaemonApp::mainLoop(bool logToFile, bool foreground)
|
||||||
DAEMON_RUNNING(true);
|
DAEMON_RUNNING(true);
|
||||||
|
|
||||||
if (logToFile) {
|
if (logToFile) {
|
||||||
m_fileLogOutputter = std::make_unique<FileLogOutputter>(logFilename().c_str());
|
m_fileLogOutputter = new FileLogOutputter(logFilename().c_str()); // NOSONAR -- Adopted by `Log`
|
||||||
CLOG->insert(m_fileLogOutputter.get());
|
CLOG->insert(m_fileLogOutputter);
|
||||||
}
|
}
|
||||||
|
|
||||||
// create socket multiplexer. this must happen after daemonization
|
// create socket multiplexer. this must happen after daemonization
|
||||||
|
|
@ -220,7 +220,7 @@ void DaemonApp::mainLoop(bool logToFile, bool foreground)
|
||||||
|
|
||||||
#if SYSAPI_WIN32
|
#if SYSAPI_WIN32
|
||||||
m_watchdog = std::make_unique<MSWindowsWatchdog>(false, *m_ipcServer, *m_ipcLogOutputter, foreground);
|
m_watchdog = std::make_unique<MSWindowsWatchdog>(false, *m_ipcServer, *m_ipcLogOutputter, foreground);
|
||||||
m_watchdog->setFileLogOutputter(m_fileLogOutputter.get());
|
m_watchdog->setFileLogOutputter(m_fileLogOutputter);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_events->adoptHandler(
|
m_events->adoptHandler(
|
||||||
|
|
|
||||||
|
|
@ -47,5 +47,5 @@ private:
|
||||||
std::unique_ptr<IpcServer> m_ipcServer;
|
std::unique_ptr<IpcServer> m_ipcServer;
|
||||||
std::unique_ptr<IpcLogOutputter> m_ipcLogOutputter;
|
std::unique_ptr<IpcLogOutputter> m_ipcLogOutputter;
|
||||||
std::unique_ptr<IEventQueue> m_events;
|
std::unique_ptr<IEventQueue> m_events;
|
||||||
std::unique_ptr<FileLogOutputter> m_fileLogOutputter;
|
FileLogOutputter *m_fileLogOutputter = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue