Fix various memory leaks

This commit is contained in:
Tony Butler 2021-10-24 23:22:58 -06:00
parent f8f73b0cd7
commit f6d45f7990
5 changed files with 19 additions and 1 deletions

View file

@ -316,6 +316,14 @@ xmrig::CnHash::CnHash()
}
xmrig::CnHash::~CnHash()
{
for (auto const& x : m_map) {
delete m_map[x.first];
}
}
xmrig::cn_hash_fun xmrig::CnHash::fn(const Algorithm &algorithm, AlgoVariant av, Assembly::Id assembly)
{
assert(cnHash.m_map.count(algorithm));

View file

@ -59,6 +59,7 @@ public:
};
CnHash();
virtual ~CnHash();
static cn_hash_fun fn(const Algorithm &algorithm, AlgoVariant av, Assembly::Id assembly);

View file

@ -410,6 +410,7 @@ extern "C" {
}
void randomx_release_cache(randomx_cache* cache) {
delete cache->jit;
delete cache;
}