Fixed some Coverity reports

pull/22/head
SChernykh 3 years ago
parent b025056653
commit a36825424b

@ -1 +1 @@
Subproject commit f1fb56896ed4ab5bf5d1040931b60c73204097c7
Subproject commit 0b4d553b20a20387a52730e3e7d234e7a4042419

@ -911,10 +911,11 @@ uint32_t BlockTemplate::get_hashing_blobs(uint32_t extra_nonce_start, uint32_t c
for (uint32_t i = 0; i < count; ++i) {
uint8_t blob[128];
const uint32_t n = get_hashing_blob_nolock(extra_nonce_start + i, blob);
uint32_t n = get_hashing_blob_nolock(extra_nonce_start + i, blob);
if (n > sizeof(blob)) {
LOGERR(1, "internal error: get_hashing_blob_nolock returned too large blob size " << n << ", expected <= " << sizeof(blob));
n = sizeof(blob);
}
else if (n < 76) {
LOGERR(1, "internal error: get_hashing_blob_nolock returned too little blob size " << n << ", expected >= 76");

@ -26,7 +26,10 @@ static constexpr char log_category_prefix[] = "JSONRPCRequest ";
namespace p2pool {
JSONRPCRequest::JSONRPCRequest(const char* address, int port, const char* req, CallbackBase* cb)
: m_callback(cb)
: m_socket{}
, m_connect{}
, m_write{}
, m_callback(cb)
, m_contentLength(0)
, m_contentLengthHeader(false)
, m_readBufInUse(false)

@ -1004,12 +1004,16 @@ int p2pool::run()
return 1;
}
{
try {
ZMQReader z(m_params->m_host, m_params->m_zmqPort, this);
get_info();
const int rc = uv_run(uv_default_loop_checked(), UV_RUN_DEFAULT);
LOGINFO(1, "uv_run exited, result = " << rc);
}
catch (const std::exception& e) {
LOGERR(1, "exception " << e.what());
panic();
}
m_stopped = true;

@ -130,7 +130,7 @@ void RandomX_Hasher::set_seed_async(const hash& seed)
work->seed = seed;
work->req.data = work;
uv_queue_work(uv_default_loop_checked(), &work->req,
const int err = uv_queue_work(uv_default_loop_checked(), &work->req,
[](uv_work_t* req)
{
bkg_jobs_tracker.start("RandomX_Hasher::set_seed_async");
@ -145,6 +145,14 @@ void RandomX_Hasher::set_seed_async(const hash& seed)
bkg_jobs_tracker.stop("RandomX_Hasher::set_seed_async");
}
);
if (err) {
LOGERR(1, "uv_queue_work failed, error " << uv_err_name(err));
if (!work->pool->stopped()) {
work->hasher->set_seed(work->seed);
}
delete work;
}
}
void RandomX_Hasher::set_seed(const hash& seed)

@ -634,8 +634,7 @@ void SideChain::print_status()
Wallet w = m_pool->params().m_wallet;
hash eph_public_key;
for (size_t i = 0, n = m_chainTip->m_outputs.size(); i < n; ++i) {
w.get_eph_public_key(m_chainTip->m_txkeySec, i, eph_public_key);
if (m_chainTip->m_outputs[i].m_ephPublicKey == eph_public_key) {
if (w.get_eph_public_key(m_chainTip->m_txkeySec, i, eph_public_key) && (m_chainTip->m_outputs[i].m_ephPublicKey == eph_public_key)) {
reward_share = m_chainTip->m_outputs[i].m_reward;
break;
}

@ -178,7 +178,7 @@ private:
protected:
void start_listening(const std::string& listen_addresses);
std::atomic<int> m_finished{ 0 };
std::atomic<int> m_finished;
int m_listenPort;
uv_loop_t m_loop;

@ -24,6 +24,8 @@ namespace p2pool {
template<size_t READ_BUF_SIZE, size_t WRITE_BUF_SIZE>
TCPServer<READ_BUF_SIZE, WRITE_BUF_SIZE>::TCPServer(allocate_client_callback allocate_new_client)
: m_allocateNewClient(allocate_new_client)
, m_loopThread{}
, m_finished(0)
, m_listenPort(-1)
, m_loopStopped(false)
, m_numConnections(0)

@ -50,7 +50,6 @@ ZMQReader::ZMQReader(const char* address, uint32_t zmq_port, MinerCallbackHandle
if (!m_publisherPort) {
LOGERR(1, "failed to to bind ZMQ publisher port, aborting");
panic();
}
const int err = uv_thread_create(&m_worker, run_wrapper, this);

Loading…
Cancel
Save