From ab96a4a6708a58109154fb3e0959c1b03c3ce302 Mon Sep 17 00:00:00 2001 From: Treeki Date: Wed, 12 Feb 2014 13:26:46 +0100 Subject: bouncer: fix massive memory leak where cached packets were not freed --- bouncer/client.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'bouncer') diff --git a/bouncer/client.cpp b/bouncer/client.cpp index d04d0be..79e97a2 100644 --- a/bouncer/client.cpp +++ b/bouncer/client.cpp @@ -124,8 +124,13 @@ void Client::generateSessionKey() { void Client::clearCachedPackets(int maxID) { packetCache.remove_if([maxID](Packet *&pkt) { - return (pkt->id <= maxID); - }); + if (pkt->id <= maxID) { + delete pkt; + return true; + } else { + return false; + } + }); } -- cgit v1.2.3