diff --git a/src/StorageCache.cpp b/src/StorageCache.cpp index 29908c7f5..6e1d4af9a 100644 --- a/src/StorageCache.cpp +++ b/src/StorageCache.cpp @@ -25,6 +25,12 @@ StorageCache::StorageCache(IStorage *storage, bool fCache) m_pdict = dictCreate(&dbStorageCacheType, nullptr); } +StorageCache::~StorageCache() +{ + if (m_pdict != nullptr) + dictRelease(m_pdict); +} + void StorageCache::clear() { std::unique_lock ul(m_lock); diff --git a/src/StorageCache.h b/src/StorageCache.h index ed868e74b..9f92f75c0 100644 --- a/src/StorageCache.h +++ b/src/StorageCache.h @@ -29,6 +29,8 @@ class StorageCache } public: + ~StorageCache(); + static StorageCache *create(IStorageFactory *pfactory, int db, IStorageFactory::key_load_iterator fn, void *privdata) { StorageCache *cache = new StorageCache(nullptr, pfactory->FSlow() /*fCache*/); load_iter_data data = {cache, fn, privdata};