Skip to content

Commit 63e6e89

Browse files
committed
Postfix for #8429: Segfault when already destroyed callback interface is used; fixed performance regression
1 parent 859d506 commit 63e6e89

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/remote/server/server.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ class CryptKeyCallback : public VersionedIface<ICryptKeyCallbackImpl<CryptKeyCal
197197
{
198198
public:
199199
explicit CryptKeyCallback(rem_port* prt)
200-
: port(prt), networkCallback(prt), keyHolder(NULL), keyCallback(NULL)
200+
: port(prt), networkCallback(prt)
201201
{ }
202202

203203
~CryptKeyCallback()
@@ -209,7 +209,7 @@ class CryptKeyCallback : public VersionedIface<ICryptKeyCallbackImpl<CryptKeyCal
209209

210210
void loadClientKey()
211211
{
212-
if (keyCallback)
212+
if (clientKeyChecked)
213213
return;
214214

215215
Reference r(*port);
@@ -241,6 +241,8 @@ class CryptKeyCallback : public VersionedIface<ICryptKeyCallbackImpl<CryptKeyCal
241241
check(&st);
242242
}
243243
}
244+
245+
clientKeyChecked = true;
244246
}
245247

246248
void wakeup(unsigned int length, const void* data)
@@ -330,8 +332,9 @@ class CryptKeyCallback : public VersionedIface<ICryptKeyCallbackImpl<CryptKeyCal
330332
private:
331333
rem_port* port;
332334
NetworkCallback networkCallback;
333-
IKeyHolderPlugin* keyHolder;
334-
ICryptKeyCallback* keyCallback;
335+
IKeyHolderPlugin* keyHolder = nullptr;
336+
ICryptKeyCallback* keyCallback = nullptr;
337+
bool clientKeyChecked = false;
335338
};
336339

337340
class ServerCallback : public ServerCallbackBase, public GlobalStorage

0 commit comments

Comments
 (0)