From 949437d559bcb0d40f6fe4fa81984a2467b7b52f Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Sun, 22 Nov 2015 05:10:16 -0500 Subject: [PATCH] cpu: Fix memory leak in traffic generator In cases where we discard the packet, make sure to also delete it and the associated request. --- src/cpu/testers/traffic_gen/traffic_gen.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cpu/testers/traffic_gen/traffic_gen.cc b/src/cpu/testers/traffic_gen/traffic_gen.cc index 984c9950d..f8eb38d31 100644 --- a/src/cpu/testers/traffic_gen/traffic_gen.cc +++ b/src/cpu/testers/traffic_gen/traffic_gen.cc @@ -198,6 +198,9 @@ TrafficGen::update() } else { DPRINTF(TrafficGen, "Suppressed packet %s 0x%x\n", pkt->cmdString(), pkt->getAddr()); + delete pkt->req; + delete pkt; + pkt = nullptr; } } -- 2.30.2