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/mem/cache/tags/fa_lru.cc | 8 ++++++++ src/mem/cache/tags/fa_lru.hh | 1 + src/mem/cache/tags/iic.cc | 1 + 3 files changed, 10 insertions(+) (limited to 'src/mem/cache/tags') diff --git a/src/mem/cache/tags/fa_lru.cc b/src/mem/cache/tags/fa_lru.cc index 873883c1b..3a1246ce7 100644 --- a/src/mem/cache/tags/fa_lru.cc +++ b/src/mem/cache/tags/fa_lru.cc @@ -98,6 +98,14 @@ FALRU::FALRU(unsigned _blkSize, unsigned _size, unsigned hit_latency) //assert(check()); } +FALRU::~FALRU() +{ + if (numCaches) + delete[] cacheBoundaries; + + delete[] blks; +} + void FALRU::regStats(const string &name) { diff --git a/src/mem/cache/tags/fa_lru.hh b/src/mem/cache/tags/fa_lru.hh index 78f9ce1b4..fa1f49a42 100644 --- a/src/mem/cache/tags/fa_lru.hh +++ b/src/mem/cache/tags/fa_lru.hh @@ -156,6 +156,7 @@ public: * @param hit_latency The hit latency of the cache. */ FALRU(unsigned blkSize, unsigned size, unsigned hit_latency); + ~FALRU(); /** * Register the stats for this object. diff --git a/src/mem/cache/tags/iic.cc b/src/mem/cache/tags/iic.cc index 260b89194..d6ddf04a6 100644 --- a/src/mem/cache/tags/iic.cc +++ b/src/mem/cache/tags/iic.cc @@ -160,6 +160,7 @@ IIC::~IIC() delete [] dataStore; delete [] tagStore; delete [] sets; + delete [] dataBlks; } /* register cache stats */ -- cgit v1.2.3