summaryrefslogtreecommitdiffstats
path: root/common/rfb/SConnection.cxx
diff options
context:
space:
mode:
authorMichal Srb <michalsrb@gmail.com>2017-03-27 13:55:46 +0300
committerMichal Srb <michalsrb@gmail.com>2017-03-27 13:55:46 +0300
commitdccb5f7d776e93863ae10bbff56a45c523c6eeb0 (patch)
tree66470b930a2659ce7c585fa55cd6676f6377e19f /common/rfb/SConnection.cxx
parentbf3bdac082978ca32895a4b6a123016094905689 (diff)
downloadtigervnc-dccb5f7d776e93863ae10bbff56a45c523c6eeb0.tar.gz
tigervnc-dccb5f7d776e93863ae10bbff56a45c523c6eeb0.zip
Prevent leak of SecurityServer and ClientServer.
They are created in SConnection's and CConnection's constructors but never destroyed. There is no reason for the indirection, so lets make them direct members.
Diffstat (limited to 'common/rfb/SConnection.cxx')
-rw-r--r--common/rfb/SConnection.cxx12
1 files changed, 5 insertions, 7 deletions
diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx
index 17ef4d90..85cc6e82 100644
--- a/common/rfb/SConnection.cxx
+++ b/common/rfb/SConnection.cxx
@@ -51,7 +51,7 @@ const SConnection::AccessRights SConnection::AccessFull = 0xffff;
SConnection::SConnection()
: readyForSetColourMapEntries(false),
is(0), os(0), reader_(0), writer_(0),
- security(0), ssecurity(0), state_(RFBSTATE_UNINITIALISED),
+ ssecurity(0), state_(RFBSTATE_UNINITIALISED),
preferredEncoding(encodingRaw)
{
defaultMajorVersion = 3;
@@ -60,8 +60,6 @@ SConnection::SConnection()
defaultMinorVersion = 3;
cp.setVersion(defaultMajorVersion, defaultMinorVersion);
-
- security = new SecurityServer();
}
SConnection::~SConnection()
@@ -142,7 +140,7 @@ void SConnection::processVersionMsg()
std::list<rdr::U8> secTypes;
std::list<rdr::U8>::iterator i;
- secTypes = security->GetEnabledSecTypes();
+ secTypes = security.GetEnabledSecTypes();
if (cp.isVersion(3,3)) {
@@ -161,7 +159,7 @@ void SConnection::processVersionMsg()
os->writeU32(*i);
if (*i == secTypeNone) os->flush();
state_ = RFBSTATE_SECURITY;
- ssecurity = security->GetSSecurity(*i);
+ ssecurity = security.GetSSecurity(*i);
processSecurityMsg();
return;
}
@@ -193,7 +191,7 @@ void SConnection::processSecurityType(int secType)
std::list<rdr::U8> secTypes;
std::list<rdr::U8>::iterator i;
- secTypes = security->GetEnabledSecTypes();
+ secTypes = security.GetEnabledSecTypes();
for (i=secTypes.begin(); i!=secTypes.end(); i++)
if (*i == secType) break;
if (i == secTypes.end())
@@ -204,7 +202,7 @@ void SConnection::processSecurityType(int secType)
try {
state_ = RFBSTATE_SECURITY;
- ssecurity = security->GetSSecurity(secType);
+ ssecurity = security.GetSSecurity(secType);
} catch (rdr::Exception& e) {
throwConnFailedException(e.str());
}