mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
Catch more exceptions in dtors
Misc coverity reports
This commit is contained in:
parent
83d8f03c23
commit
e5108a294a
17 changed files with 43 additions and 1 deletions
|
@ -147,7 +147,8 @@ namespace misc_utils
|
||||||
{}
|
{}
|
||||||
~call_befor_die()
|
~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() {
|
threadpool::~threadpool() {
|
||||||
|
try
|
||||||
{
|
{
|
||||||
const boost::unique_lock<boost::mutex> lock(mutex);
|
const boost::unique_lock<boost::mutex> lock(mutex);
|
||||||
running = false;
|
running = false;
|
||||||
has_work.notify_all();
|
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++) {
|
for (size_t i = 0; i<threads.size(); i++) {
|
||||||
try { threads[i].join(); }
|
try { threads[i].join(); }
|
||||||
catch (...) { /* ignore */ }
|
catch (...) { /* ignore */ }
|
||||||
|
@ -91,11 +99,13 @@ unsigned int threadpool::get_max_concurrency() const {
|
||||||
|
|
||||||
threadpool::waiter::~waiter()
|
threadpool::waiter::~waiter()
|
||||||
{
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::mutex> lock(mt);
|
boost::unique_lock<boost::mutex> lock(mt);
|
||||||
if (num)
|
if (num)
|
||||||
MERROR("wait should have been called before waiter dtor - waiting now");
|
MERROR("wait should have been called before waiter dtor - waiting now");
|
||||||
}
|
}
|
||||||
|
catch (...) { /* ignore */ }
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
wait(NULL);
|
wait(NULL);
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "warnings.h"
|
#include "warnings.h"
|
||||||
|
#include "misc_log_ex.h"
|
||||||
#include "crypto/crypto.h"
|
#include "crypto/crypto.h"
|
||||||
#include "crypto/hash.h"
|
#include "crypto/hash.h"
|
||||||
#include "crypto-tests.h"
|
#include "crypto-tests.h"
|
||||||
|
@ -59,6 +60,7 @@ bool operator !=(const key_derivation &a, const key_derivation &b) {
|
||||||
DISABLE_GCC_WARNING(maybe-uninitialized)
|
DISABLE_GCC_WARNING(maybe-uninitialized)
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
TRY_ENTRY();
|
||||||
fstream input;
|
fstream input;
|
||||||
string cmd;
|
string cmd;
|
||||||
size_t test = 0;
|
size_t test = 0;
|
||||||
|
@ -266,4 +268,5 @@ error:
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
return error ? 1 : 0;
|
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)
|
int main(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
|
TRY_ENTRY();
|
||||||
Base58Fuzzer fuzzer;
|
Base58Fuzzer fuzzer;
|
||||||
return run_fuzzer(argc, argv, 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)
|
int main(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
|
TRY_ENTRY();
|
||||||
BlockFuzzer fuzzer;
|
BlockFuzzer fuzzer;
|
||||||
return run_fuzzer(argc, argv, 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)
|
int main(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
|
TRY_ENTRY();
|
||||||
BulletproofFuzzer fuzzer;
|
BulletproofFuzzer fuzzer;
|
||||||
return run_fuzzer(argc, argv, 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)
|
int main(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
|
TRY_ENTRY();
|
||||||
ColdOutputsFuzzer fuzzer;
|
ColdOutputsFuzzer fuzzer;
|
||||||
return run_fuzzer(argc, argv, 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)
|
int main(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
|
TRY_ENTRY();
|
||||||
ColdTransactionFuzzer fuzzer;
|
ColdTransactionFuzzer fuzzer;
|
||||||
return run_fuzzer(argc, argv, 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)
|
int main(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
|
TRY_ENTRY();
|
||||||
HTTPClientFuzzer fuzzer;
|
HTTPClientFuzzer fuzzer;
|
||||||
return run_fuzzer(argc, argv, 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)
|
int main(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
|
TRY_ENTRY();
|
||||||
LevinFuzzer fuzzer;
|
LevinFuzzer fuzzer;
|
||||||
return run_fuzzer(argc, argv, 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)
|
int main(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
|
TRY_ENTRY();
|
||||||
PortableStorageFuzzer fuzzer;
|
PortableStorageFuzzer fuzzer;
|
||||||
return run_fuzzer(argc, argv, 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)
|
int main(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
|
TRY_ENTRY();
|
||||||
PortableStorageFuzzer fuzzer;
|
PortableStorageFuzzer fuzzer;
|
||||||
return run_fuzzer(argc, argv, 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)
|
int main(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
|
TRY_ENTRY();
|
||||||
ParseURLFuzzer fuzzer;
|
ParseURLFuzzer fuzzer;
|
||||||
return run_fuzzer(argc, argv, 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)
|
int main(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
|
TRY_ENTRY();
|
||||||
SignatureFuzzer fuzzer;
|
SignatureFuzzer fuzzer;
|
||||||
return run_fuzzer(argc, argv, 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)
|
int main(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
|
TRY_ENTRY();
|
||||||
TransactionFuzzer fuzzer;
|
TransactionFuzzer fuzzer;
|
||||||
return run_fuzzer(argc, argv, 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)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
TRY_ENTRY();
|
||||||
tools::on_startup();
|
tools::on_startup();
|
||||||
epee::debug::get_set_enable_assert(true, false);
|
epee::debug::get_set_enable_assert(true, false);
|
||||||
//set up logging options
|
//set up logging options
|
||||||
|
@ -635,4 +636,5 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
return RUN_ALL_TESTS();
|
return RUN_ALL_TESTS();
|
||||||
|
CATCH_ENTRY_L0("main", 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,6 +215,7 @@ namespace
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
TRY_ENTRY();
|
||||||
tools::on_startup();
|
tools::on_startup();
|
||||||
//set up logging options
|
//set up logging options
|
||||||
mlog_configure(mlog_get_default_log_path("net_load_tests_srv.log"), true);
|
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))
|
if (!tcp_server.run_server(thread_count, true))
|
||||||
return 2;
|
return 2;
|
||||||
return 0;
|
return 0;
|
||||||
|
CATCH_ENTRY_L0("main", 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue