From 20276891e6c313c0909b061b60450b342e8dd462 Mon Sep 17 00:00:00 2001 From: scatterflower Date: Thu, 3 Sep 2020 01:03:41 -0500 Subject: [PATCH] fix memory leak from incorrect delete call --- src/aoclient.cpp | 1 + src/server.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/aoclient.cpp b/src/aoclient.cpp index 257410d..14951b9 100644 --- a/src/aoclient.cpp +++ b/src/aoclient.cpp @@ -64,6 +64,7 @@ void AOClient::clientDisconnected() false; server->updateCharsTaken(server->areas[current_area]); } + cleanup(); } void AOClient::handlePacket(AOPacket packet) diff --git a/src/server.cpp b/src/server.cpp index 74c43b0..f10281c 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -83,7 +83,7 @@ void Server::clientConnected() connect(socket, &QTcpSocket::disconnected, this, [=] { qDebug() << "removed client" << client->getIpid(); clients.removeAll(client); - delete client; + client->deleteLater(); }); connect(socket, &QTcpSocket::readyRead, client, &AOClient::clientData);