From ff5718f042ecccee694ae79c9386a589fd77e8ef Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Mon, 9 Jul 2012 12:35:30 -0400 Subject: Fix: Address a few benign memory leaks This patch is the result of static analysis identifying a number of memory leaks. The leaks are all benign as they are a result of not deallocating memory in the desctructor. The fix still has value as it removes false positives in the static analysis. --- src/dev/arm/pl111.cc | 5 +++++ src/dev/arm/pl111.hh | 1 + src/dev/ethertap.cc | 1 + src/dev/i8254xGBe.cc | 7 +++++++ src/dev/i8254xGBe.hh | 2 +- src/dev/ns_gige.cc | 4 +++- 6 files changed, 18 insertions(+), 2 deletions(-) (limited to 'src/dev') diff --git a/src/dev/arm/pl111.cc b/src/dev/arm/pl111.cc index 7c25958e0..c1edc29ea 100644 --- a/src/dev/arm/pl111.cc +++ b/src/dev/arm/pl111.cc @@ -84,6 +84,11 @@ Pl111::Pl111(const Params *p) vncserver->setFramebufferAddr(dmaBuffer); } +Pl111::~Pl111() +{ + delete[] dmaBuffer; +} + // read registers and frame buffer Tick Pl111::read(PacketPtr pkt) diff --git a/src/dev/arm/pl111.hh b/src/dev/arm/pl111.hh index e0a03641c..36dfc46c1 100644 --- a/src/dev/arm/pl111.hh +++ b/src/dev/arm/pl111.hh @@ -316,6 +316,7 @@ class Pl111: public AmbaDmaDevice return dynamic_cast(_params); } Pl111(const Params *p); + ~Pl111(); virtual Tick read(PacketPtr pkt); virtual Tick write(PacketPtr pkt); diff --git a/src/dev/ethertap.cc b/src/dev/ethertap.cc index 2a85aa524..94e381a8e 100644 --- a/src/dev/ethertap.cc +++ b/src/dev/ethertap.cc @@ -147,6 +147,7 @@ EtherTap::~EtherTap() if (buffer) delete [] buffer; + delete interface; delete listener; } diff --git a/src/dev/i8254xGBe.cc b/src/dev/i8254xGBe.cc index 29bd5adc2..1f2c92425 100644 --- a/src/dev/i8254xGBe.cc +++ b/src/dev/i8254xGBe.cc @@ -122,6 +122,11 @@ IGbE::IGbE(const Params *p) txFifo.clear(); } +IGbE::~IGbE() +{ + delete etherInt; +} + void IGbE::init() { @@ -827,6 +832,8 @@ template IGbE::DescCache::~DescCache() { reset(); + delete[] fetchBuf; + delete[] wbBuf; } template diff --git a/src/dev/i8254xGBe.hh b/src/dev/i8254xGBe.hh index 7c31222ed..a6b20a2bf 100644 --- a/src/dev/i8254xGBe.hh +++ b/src/dev/i8254xGBe.hh @@ -518,7 +518,7 @@ class IGbE : public EtherDevice } IGbE(const Params *params); - ~IGbE() {} + ~IGbE(); virtual void init(); virtual EtherInt *getEthPort(const std::string &if_name, int idx); diff --git a/src/dev/ns_gige.cc b/src/dev/ns_gige.cc index 4dc4aeae9..4a459c6c6 100644 --- a/src/dev/ns_gige.cc +++ b/src/dev/ns_gige.cc @@ -135,7 +135,9 @@ NSGigE::NSGigE(Params *p) } NSGigE::~NSGigE() -{} +{ + delete interface; +} /** * This is to write to the PCI general configuration registers -- cgit v1.2.3