[icinga-checkins] icinga.org: icinga2/master: Fix crash in JsonRpcConnection:: MessageHandlerWrapper

git at icinga.org git at icinga.org
Mon Aug 22 17:48:53 CEST 2016


Module: icinga2
Branch: master
Commit: f4dce0fe729dedf8138788a535e01fd8c6cde766
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=f4dce0fe729dedf8138788a535e01fd8c6cde766

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Mon Aug 22 16:35:16 2016 +0200

Fix crash in JsonRpcConnection::MessageHandlerWrapper

fixes #12506

---

 lib/remote/httpserverconnection.cpp |    9 +--------
 lib/remote/jsonrpcconnection.cpp    |    6 +-----
 2 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/lib/remote/httpserverconnection.cpp b/lib/remote/httpserverconnection.cpp
index acf5ccd..d3f7586 100644
--- a/lib/remote/httpserverconnection.cpp
+++ b/lib/remote/httpserverconnection.cpp
@@ -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);
 
diff --git a/lib/remote/jsonrpcconnection.cpp b/lib/remote/jsonrpcconnection.cpp
index 54c3935..69321a6 100644
--- a/lib/remote/jsonrpcconnection.cpp
+++ b/lib/remote/jsonrpcconnection.cpp
@@ -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);



More information about the icinga-checkins mailing list