]> granicus.if.org Git - icinga2/commitdiff
Fix crash in JsonRpcConnection::MessageHandlerWrapper
authorGunnar Beutner <gunnar.beutner@netways.de>
Mon, 22 Aug 2016 14:35:16 +0000 (16:35 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Mon, 22 Aug 2016 15:42:59 +0000 (17:42 +0200)
fixes #12506

lib/remote/httpserverconnection.cpp
lib/remote/jsonrpcconnection.cpp

index acf5ccd1d6e008aad75b662d34a3cbb0b8bfc271..d3f75868bd9cf19782330c5dbba98606cd58046d 100644 (file)
@@ -83,11 +83,7 @@ void HttpServerConnection::Disconnect(void)
        m_CurrentRequest.~HttpRequest();
        new (&m_CurrentRequest) HttpRequest(Stream::Ptr());
 
-       {
-               Stream::Ptr stream = m_Stream;
-               m_Stream.reset();
-               stream->Close();
-       }
+       m_Stream->Close();
 }
 
 bool HttpServerConnection::ProcessMessage(void)
@@ -211,9 +207,6 @@ void HttpServerConnection::DataAvailableHandler(void)
 {
        bool close = false;
 
-       if (!m_Stream)
-               return;
-
        if (!m_Stream->IsEof()) {
                boost::mutex::scoped_lock lock(m_DataHandlerMutex);
 
index 54c393550b35d48b487a511536000100e4289dee..69321a63ebb0f8a7129836950f0717b6b0232176 100644 (file)
@@ -129,11 +129,7 @@ void JsonRpcConnection::Disconnect(void)
        Log(LogWarning, "JsonRpcConnection")
            << "API client disconnected for identity '" << m_Identity << "'";
 
-       {
-               Stream::Ptr stream = m_Stream;
-               m_Stream.reset();
-               stream->Close();
-       }
+       m_Stream->Close();
 
        if (m_Endpoint)
                m_Endpoint->RemoveClient(this);