aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/epee/include/mlocker.h2
-rw-r--r--contrib/epee/src/mlocker.cpp3
-rw-r--r--src/common/http_connection.h3
-rw-r--r--src/wallet/wallet2.cpp7
4 files changed, 11 insertions, 4 deletions
diff --git a/contrib/epee/include/mlocker.h b/contrib/epee/include/mlocker.h
index d2fc2ed58..a6d94b3d2 100644
--- a/contrib/epee/include/mlocker.h
+++ b/contrib/epee/include/mlocker.h
@@ -73,7 +73,7 @@ namespace epee
mlocked(const T &&t): T(t) { mlocker::lock(this, sizeof(T)); }
mlocked(const mlocked<T> &&mt): T(mt) { mlocker::lock(this, sizeof(T)); }
mlocked<T> &operator=(const mlocked<T> &mt) { T::operator=(mt); return *this; }
- ~mlocked() { mlocker::unlock(this, sizeof(T)); }
+ ~mlocked() { try { mlocker::unlock(this, sizeof(T)); } catch (...) { /* do not propagate */ } }
};
template<typename T>
diff --git a/contrib/epee/src/mlocker.cpp b/contrib/epee/src/mlocker.cpp
index 5573d591a..eb863b9af 100644
--- a/contrib/epee/src/mlocker.cpp
+++ b/contrib/epee/src/mlocker.cpp
@@ -108,7 +108,8 @@ namespace epee
mlocker::~mlocker()
{
- unlock(ptr, len);
+ try { unlock(ptr, len); }
+ catch (...) { /* ignore and do not propagate through the dtor */ }
}
void mlocker::lock(void *ptr, size_t len)
diff --git a/src/common/http_connection.h b/src/common/http_connection.h
index 9fc6be261..554dd832b 100644
--- a/src/common/http_connection.h
+++ b/src/common/http_connection.h
@@ -55,7 +55,8 @@ public:
{
if (m_ok)
{
- mp_http_client->disconnect();
+ try { mp_http_client->disconnect(); }
+ catch (...) { /* do not propagate through dtor */ }
}
}
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 6f919d12c..0eda7f52d 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -815,7 +815,12 @@ wallet_keys_unlocker::~wallet_keys_unlocker()
{
if (!locked)
return;
- w.encrypt_keys(key);
+ try { w.encrypt_keys(key); }
+ catch (...)
+ {
+ MERROR("Failed to re-encrypt wallet keys");
+ // do not propagate through dtor, we'd crash
+ }
}
wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended):