summaryrefslogtreecommitdiff
path: root/bouncer
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2014-02-12 13:26:46 +0100
committerTreeki <treeki@gmail.com>2014-02-12 13:26:46 +0100
commitab96a4a6708a58109154fb3e0959c1b03c3ce302 (patch)
tree290da57bd12e4f996a4f7898c97e5a18e87aa904 /bouncer
parent44f0ddfd1d583dadf277db67104dde4facbc53d4 (diff)
downloadbounce4-ab96a4a6708a58109154fb3e0959c1b03c3ce302.tar.gz
bounce4-ab96a4a6708a58109154fb3e0959c1b03c3ce302.zip
bouncer: fix massive memory leak where cached packets were not freed
Diffstat (limited to 'bouncer')
-rw-r--r--bouncer/client.cpp9
1 files changed, 7 insertions, 2 deletions
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;
+ }
+ });
}