cpu: Fix memory leak in traffic generator
authorAndreas Hansson <andreas.hansson@arm.com>
Sun, 22 Nov 2015 10:10:16 +0000 (05:10 -0500)
committerAndreas Hansson <andreas.hansson@arm.com>
Sun, 22 Nov 2015 10:10:16 +0000 (05:10 -0500)
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

index 984c9950d257fa48a01467c126bc7d903aee1353..f8eb38d315e6c882a3b68286907e949ba79566d8 100644 (file)
@@ -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;
         }
     }