mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-23 03:13:28 +01:00
Catch more exceptions in dtors
Misc coverity reports
This commit is contained in:
parent
83d8f03c23
commit
e5108a294a
@ -147,7 +147,8 @@ namespace misc_utils
|
||||
{}
|
||||
~call_befor_die()
|
||||
{
|
||||
m_func();
|
||||
try { m_func(); }
|
||||
catch (...) { /* ignore */ }
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -51,11 +51,19 @@ threadpool::threadpool(unsigned int max_threads) : running(true), active(0) {
|
||||
}
|
||||
|
||||
threadpool::~threadpool() {
|
||||
try
|
||||
{
|
||||
const boost::unique_lock<boost::mutex> lock(mutex);
|
||||
running = false;
|
||||
has_work.notify_all();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// if the lock throws, we're just do it without a lock and hope,
|
||||
// since the alternative is terminate
|
||||
running = false;
|
||||
has_work.notify_all();
|
||||
}
|
||||
for (size_t i = 0; i<threads.size(); i++) {
|
||||
try { threads[i].join(); }
|
||||
catch (...) { /* ignore */ }
|
||||
@ -91,11 +99,13 @@ unsigned int threadpool::get_max_concurrency() const {
|
||||
|
||||
threadpool::waiter::~waiter()
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::unique_lock<boost::mutex> lock(mt);
|
||||
if (num)
|
||||
MERROR("wait should have been called before waiter dtor - waiting now");
|
||||
}
|
||||
catch (...) { /* ignore */ }
|
||||
try
|
||||
{
|
||||
wait(NULL);
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "warnings.h"
|
||||
#include "misc_log_ex.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "crypto/hash.h"
|
||||
#include "crypto-tests.h"
|
||||
@ -59,6 +60,7 @@ bool operator !=(const key_derivation &a, const key_derivation &b) {
|
||||
DISABLE_GCC_WARNING(maybe-uninitialized)
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
TRY_ENTRY();
|
||||
fstream input;
|
||||
string cmd;
|
||||
size_t test = 0;
|
||||
@ -266,4 +268,5 @@ error:
|
||||
error = true;
|
||||
}
|
||||
return error ? 1 : 0;
|
||||
CATCH_ENTRY_L0("main", 1);
|
||||
}
|
||||
|
@ -68,7 +68,9 @@ int Base58Fuzzer::run(const std::string &filename)
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
Base58Fuzzer fuzzer;
|
||||
return run_fuzzer(argc, argv, fuzzer);
|
||||
CATCH_ENTRY_L0("main", 1);
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,8 @@ int BlockFuzzer::run(const std::string &filename)
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
BlockFuzzer fuzzer;
|
||||
return run_fuzzer(argc, argv, fuzzer);
|
||||
CATCH_ENTRY_L0("main", 1);
|
||||
}
|
||||
|
@ -65,6 +65,8 @@ int BulletproofFuzzer::run(const std::string &filename)
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
BulletproofFuzzer fuzzer;
|
||||
return run_fuzzer(argc, argv, fuzzer);
|
||||
CATCH_ENTRY_L0("main", 1);
|
||||
}
|
||||
|
@ -95,7 +95,9 @@ int ColdOutputsFuzzer::run(const std::string &filename)
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
ColdOutputsFuzzer fuzzer;
|
||||
return run_fuzzer(argc, argv, fuzzer);
|
||||
CATCH_ENTRY_L0("main", 1);
|
||||
}
|
||||
|
||||
|
@ -97,6 +97,8 @@ int ColdTransactionFuzzer::run(const std::string &filename)
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
ColdTransactionFuzzer fuzzer;
|
||||
return run_fuzzer(argc, argv, fuzzer);
|
||||
CATCH_ENTRY_L0("main", 1);
|
||||
}
|
||||
|
@ -92,7 +92,9 @@ int HTTPClientFuzzer::run(const std::string &filename)
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
HTTPClientFuzzer fuzzer;
|
||||
return run_fuzzer(argc, argv, fuzzer);
|
||||
CATCH_ENTRY_L0("main", 1);
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,9 @@ int LevinFuzzer::run(const std::string &filename)
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
LevinFuzzer fuzzer;
|
||||
return run_fuzzer(argc, argv, fuzzer);
|
||||
CATCH_ENTRY_L0("main", 1);
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,9 @@ int PortableStorageFuzzer::run(const std::string &filename)
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
PortableStorageFuzzer fuzzer;
|
||||
return run_fuzzer(argc, argv, fuzzer);
|
||||
CATCH_ENTRY_L0("main", 1);
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,9 @@ int PortableStorageFuzzer::run(const std::string &filename)
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
PortableStorageFuzzer fuzzer;
|
||||
return run_fuzzer(argc, argv, fuzzer);
|
||||
CATCH_ENTRY_L0("main", 1);
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,9 @@ int ParseURLFuzzer::run(const std::string &filename)
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
ParseURLFuzzer fuzzer;
|
||||
return run_fuzzer(argc, argv, fuzzer);
|
||||
CATCH_ENTRY_L0("main", 1);
|
||||
}
|
||||
|
||||
|
@ -92,6 +92,8 @@ int SignatureFuzzer::run(const std::string &filename)
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
SignatureFuzzer fuzzer;
|
||||
return run_fuzzer(argc, argv, fuzzer);
|
||||
CATCH_ENTRY_L0("main", 1);
|
||||
}
|
||||
|
@ -61,6 +61,8 @@ int TransactionFuzzer::run(const std::string &filename)
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
TransactionFuzzer fuzzer;
|
||||
return run_fuzzer(argc, argv, fuzzer);
|
||||
CATCH_ENTRY_L0("main", 1);
|
||||
}
|
||||
|
@ -628,6 +628,7 @@ TEST_F(net_load_test_clt, permament_open_and_close_and_connections_closed_by_ser
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
tools::on_startup();
|
||||
epee::debug::get_set_enable_assert(true, false);
|
||||
//set up logging options
|
||||
@ -635,4 +636,5 @@ int main(int argc, char** argv)
|
||||
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
CATCH_ENTRY_L0("main", 1);
|
||||
}
|
||||
|
@ -215,6 +215,7 @@ namespace
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
tools::on_startup();
|
||||
//set up logging options
|
||||
mlog_configure(mlog_get_default_log_path("net_load_tests_srv.log"), true);
|
||||
@ -233,4 +234,5 @@ int main(int argc, char** argv)
|
||||
if (!tcp_server.run_server(thread_count, true))
|
||||
return 2;
|
||||
return 0;
|
||||
CATCH_ENTRY_L0("main", 1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user