fix potential duplicate cleanup
This commit is contained in:
@@ -183,8 +183,10 @@ void Connection::run() {
|
||||
}
|
||||
}
|
||||
|
||||
delete m_socket;
|
||||
m_socket = nullptr;
|
||||
if (m_socket) {
|
||||
delete m_socket;
|
||||
m_socket = nullptr;
|
||||
}
|
||||
logInfo(lf_network, "[%05d] connection closed", getID());
|
||||
}
|
||||
|
||||
|
||||
+6
-1
@@ -231,7 +231,12 @@ class Connection : public Thread {
|
||||
m_id = ++m_ids;
|
||||
}
|
||||
|
||||
virtual ~Connection() { if (m_socket) delete m_socket; }
|
||||
virtual ~Connection() {
|
||||
if (m_socket) {
|
||||
delete m_socket;
|
||||
m_socket = nullptr;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* endless loop for connection instance.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user