server: Protect several fields from potentially pointing to bad memory

This commit is contained in:
Justin Berger authored and Brad King committed 2017-08-31 15:35:46 -04:00
1 parent 693fa0a96e
commit 124424e997
2 files changed
+7 -1

No files matched your search

+4 -1
View File
@@ -118,7 +118,9 @@ void cmEventBasedConnection::OnDisconnect(int onerror)
{
(void)onerror;
this->OnConnectionShuttingDown();
this->Server->OnDisconnect(this);
if (this->Server) {
this->Server->OnDisconnect(this);
}
}
cmConnection::~cmConnection()
@@ -127,6 +129,7 @@ cmConnection::~cmConnection()
bool cmConnection::OnConnectionShuttingDown()
{
this->Server = nullptr;
return true;
}
+3
View File
@@ -53,6 +53,9 @@ void cmStdIoConnection::SetupStream(uv_stream_t*& stream, int file_id)
void cmStdIoConnection::SetServer(cmServerBase* s)
{
cmConnection::SetServer(s);
if (!s) {
return;
}
SetupStream(this->ReadStream, 0);
SetupStream(this->WriteStream, 1);