mirror of
https://github.com/debauchee/barrier.git
synced 2026-02-08 04:45:03 +08:00
fixed NULL dereference.
This commit is contained in:
@@ -44,7 +44,7 @@ CClient::~CClient()
|
||||
|
||||
void CClient::run(const CNetworkAddress& serverAddress)
|
||||
{
|
||||
CThread* thread;
|
||||
CThread* thread = NULL;
|
||||
try {
|
||||
log((CLOG_NOTE "starting client"));
|
||||
|
||||
@@ -70,18 +70,22 @@ void CClient::run(const CNetworkAddress& serverAddress)
|
||||
log((CLOG_ERR "client error: %s", e.what()));
|
||||
|
||||
// clean up
|
||||
thread->cancel();
|
||||
thread->wait();
|
||||
delete thread;
|
||||
if (thread != NULL) {
|
||||
thread->cancel();
|
||||
thread->wait();
|
||||
delete thread;
|
||||
}
|
||||
closeSecondaryScreen();
|
||||
}
|
||||
catch (...) {
|
||||
log((CLOG_DEBUG "unknown client error"));
|
||||
|
||||
// clean up
|
||||
thread->cancel();
|
||||
thread->wait();
|
||||
delete thread;
|
||||
if (thread != NULL) {
|
||||
thread->cancel();
|
||||
thread->wait();
|
||||
delete thread;
|
||||
}
|
||||
closeSecondaryScreen();
|
||||
throw;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user