Fix: possible use after free on shutdown

Console commands could access destroyed objects
This commit is contained in:
SChernykh
2022-09-08 16:16:00 +02:00
parent 3dcd3dbb7f
commit f813cf6d36
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -190,7 +190,6 @@ p2pool::~p2pool()
delete m_blockTemplate;
delete m_mempool;
delete m_params;
delete m_consoleCommands;
}
bool p2pool::calculate_hash(const void* data, size_t size, uint64_t height, const hash& seed, hash& result)
@@ -471,6 +470,8 @@ void p2pool::on_stop(uv_async_t* async)
{
p2pool* pool = reinterpret_cast<p2pool*>(async->data);
delete pool->m_consoleCommands;
if (pool->m_api) {
pool->m_api->on_stop();
}