]> granicus.if.org Git - icinga2/commitdiff
Fix possible double free in StreamLogger::BindStream()
authorMichael Friedrich <michael.friedrich@icinga.com>
Thu, 8 Nov 2018 14:51:58 +0000 (15:51 +0100)
committerMichael Friedrich <michael.friedrich@icinga.com>
Mon, 12 Nov 2018 16:07:51 +0000 (17:07 +0100)
refs #6737

lib/base/streamlogger.cpp

index 314b5440977d179d769135ed0711fce0784fe0fc..aa1d62cd3ae9267ef3f07f01219115858895538d 100644 (file)
@@ -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;