From: Michael Friedrich Date: Thu, 8 Nov 2018 14:51:58 +0000 (+0100) Subject: Fix possible double free in StreamLogger::BindStream() X-Git-Tag: v2.10.2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b3e98a842f6083ee3dbf6fa2bd545c0f59af3c77;p=icinga2 Fix possible double free in StreamLogger::BindStream() refs #6737 --- diff --git a/lib/base/streamlogger.cpp b/lib/base/streamlogger.cpp index 314b54409..aa1d62cd3 100644 --- a/lib/base/streamlogger.cpp +++ b/lib/base/streamlogger.cpp @@ -47,7 +47,7 @@ StreamLogger::~StreamLogger() if (m_FlushLogTimer) m_FlushLogTimer->Stop(); - if (m_OwnsStream) + if (m_Stream && m_OwnsStream) delete m_Stream; } @@ -66,7 +66,7 @@ void StreamLogger::BindStream(std::ostream *stream, bool ownsStream) { ObjectLock olock(this); - if (m_OwnsStream) + if (m_Stream && m_OwnsStream) delete m_Stream; m_Stream = stream;