Fix: possible use after free on shutdown

Console commands could access destroyed objects
pull/206/head
SChernykh 2 years ago
parent 3dcd3dbb7f
commit f813cf6d36

@ -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();
}

@ -36,7 +36,7 @@ public:
bool connect_to_peer(bool is_v6, const char* ip, int port);
void drop_connections_async() { uv_async_send(&m_dropConnectionsAsync); }
void drop_connections_async() { if (m_finished.load() == 0) { uv_async_send(&m_dropConnectionsAsync); } }
void shutdown_tcp();
virtual void print_status();

Loading…
Cancel
Save