mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 08:20:18 -06:00
server: Protect several fields from potentially pointing to bad memory
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user