mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-11-17 08:17:55 +00:00
Fix: possible use after free on shutdown
Console commands could access destroyed objects
This commit is contained in:
parent
3dcd3dbb7f
commit
f813cf6d36
2 changed files with 3 additions and 2 deletions
|
@ -190,7 +190,6 @@ p2pool::~p2pool()
|
||||||
delete m_blockTemplate;
|
delete m_blockTemplate;
|
||||||
delete m_mempool;
|
delete m_mempool;
|
||||||
delete m_params;
|
delete m_params;
|
||||||
delete m_consoleCommands;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p2pool::calculate_hash(const void* data, size_t size, uint64_t height, const hash& seed, hash& result)
|
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);
|
p2pool* pool = reinterpret_cast<p2pool*>(async->data);
|
||||||
|
|
||||||
|
delete pool->m_consoleCommands;
|
||||||
|
|
||||||
if (pool->m_api) {
|
if (pool->m_api) {
|
||||||
pool->m_api->on_stop();
|
pool->m_api->on_stop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
|
|
||||||
bool connect_to_peer(bool is_v6, const char* ip, int port);
|
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();
|
void shutdown_tcp();
|
||||||
virtual void print_status();
|
virtual void print_status();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue