From eadaa6aaa3a003d07c4bdf1cfe4f540a94555a8b Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sun, 24 Dec 2017 00:02:48 +0000 Subject: [PATCH 1/2] wallet_rpc_server: fix wallet leak on error exit Makes it easier to debug leaks --- src/wallet/wallet_rpc_server.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index 0482b9dd6..d6cb5bbf1 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -89,6 +89,8 @@ namespace tools //------------------------------------------------------------------------------------------------------------------------------ wallet_rpc_server::~wallet_rpc_server() { + if (m_wallet) + delete m_wallet; } //------------------------------------------------------------------------------------------------------------------------------ void wallet_rpc_server::set_wallet(wallet2 *cr) From 9996d5e96c71cfcf1d693dd6ca533c6a4176bd10 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sat, 23 Dec 2017 23:46:35 +0000 Subject: [PATCH 2/2] wallet2: guard against the dameon sending blocks before last checkpoint --- src/wallet/wallet2.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 04c6ee236..9a0db9044 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -1951,6 +1951,11 @@ void wallet2::fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height, pull_hashes(0, blocks_start_height, short_chain_history, hashes); if (hashes.size() <= 3) return; + if (blocks_start_height < m_blockchain.offset()) + { + MERROR("Blocks start before blockchain offset: " << blocks_start_height << " " << m_blockchain.offset()); + return; + } if (hashes.size() + current_index < stop_height) { drop_from_short_history(short_chain_history, 3); std::list::iterator right = hashes.end();