aboutsummaryrefslogtreecommitdiff
path: root/src/unstable/cachebase.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2023-07-11 14:06:33 -0700
committerMike Buland <eichlan@xagasoft.com>2023-07-11 14:06:33 -0700
commit18cd5f331b8d043a7f9c4d161f2319dc456dfcc9 (patch)
tree1d91cfbce70220953882713a81ad1157eba1f884 /src/unstable/cachebase.h
parent7529ab103b0c20220a5bbe2f2ce5511e04e9acda (diff)
downloadlibbu++-18cd5f331b8d043a7f9c4d161f2319dc456dfcc9.tar.gz
libbu++-18cd5f331b8d043a7f9c4d161f2319dc456dfcc9.tar.bz2
libbu++-18cd5f331b8d043a7f9c4d161f2319dc456dfcc9.tar.xz
libbu++-18cd5f331b8d043a7f9c4d161f2319dc456dfcc9.zip
Fixed cachebase memory leak.
Diffstat (limited to 'src/unstable/cachebase.h')
-rw-r--r--src/unstable/cachebase.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/unstable/cachebase.h b/src/unstable/cachebase.h
index 7a54465..762aca2 100644
--- a/src/unstable/cachebase.h
+++ b/src/unstable/cachebase.h
@@ -34,6 +34,13 @@ namespace Bu
34 { 34 {
35 } 35 }
36 36
37 virtual ~CacheEntry()
38 {
39 mEntry.lock();
40 delete pObject;
41 mEntry.unlock();
42 }
43
37 public: 44 public:
38 int getRefCount() const 45 int getRefCount() const
39 { 46 {
@@ -386,6 +393,10 @@ namespace Bu
386 393
387 virtual ~CacheBase() 394 virtual ~CacheBase()
388 { 395 {
396 for( typename CacheEntryHash::iterator i = hCacheEntry.begin(); i; i++ )
397 {
398 delete i.getValue();
399 }
389 } 400 }
390 401
391 typedef CacheEntry<keytype, obtype> Entry; 402 typedef CacheEntry<keytype, obtype> Entry;