arm: Fix memleak in VGic by adding destructor
authorSean Wilson <spwilson2@wisc.edu>
Thu, 29 Jun 2017 14:12:26 +0000 (09:12 -0500)
committerSean Wilson <spwilson2@wisc.edu>
Thu, 29 Jun 2017 19:10:13 +0000 (19:10 +0000)
Change-Id: I864b5d9ed655cc52e440e2eb54987e8ff9a73296
Signed-off-by: Sean Wilson <spwilson2@wisc.edu>
Reviewed-on: https://gem5-review.googlesource.com/3900
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

src/dev/arm/vgic.cc
src/dev/arm/vgic.hh

index 60866f1f472fa72adf0b3feb1b83adeb50cc14b0..6744ad513e1bf92595725109fe38ae2f72de05b5 100644 (file)
@@ -60,6 +60,12 @@ VGic::VGic(const Params *p)
     assert(sys->numRunningContexts() <= VGIC_CPU_MAX);
 }
 
+VGic::~VGic()
+{
+    for (int x = 0; x < VGIC_CPU_MAX; x++)
+        delete postVIntEvent[x];
+}
+
 Tick
 VGic::read(PacketPtr pkt)
 {
index 8328673d59cca3320f6fd6633cdc65ffcbb4396a..e9bc29c18e5b9683b7af37f1b4a65818cae1ad08 100644 (file)
@@ -206,6 +206,7 @@ class VGic : public PioDevice
         return dynamic_cast<const Params *>(_params);
     }
     VGic(const Params *p);
+    ~VGic();
 
     AddrRangeList getAddrRanges() const override;