From: Andreas Hansson Date: Sun, 22 Nov 2015 10:10:16 +0000 (-0500) Subject: cpu: Fix memory leak in traffic generator X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=949437d559bcb0d40f6fe4fa81984a2467b7b52f;p=gem5.git cpu: Fix memory leak in traffic generator In cases where we discard the packet, make sure to also delete it and the associated request. --- 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; } }