mirror of
https://github.com/monero-project/monero.git
synced 2024-12-25 15:39:41 -05:00
fix a few leaks by throwing objects, not newed pointers to objects
This commit is contained in:
parent
fe568db83d
commit
d753d716a6
@ -197,7 +197,7 @@ uint64_t BlockchainDB::add_block( const block& blk
|
|||||||
{
|
{
|
||||||
// sanity
|
// sanity
|
||||||
if (blk.tx_hashes.size() != txs.size())
|
if (blk.tx_hashes.size() != txs.size())
|
||||||
throw new std::runtime_error("Inconsistent tx/hashes sizes");
|
throw std::runtime_error("Inconsistent tx/hashes sizes");
|
||||||
|
|
||||||
block_txn_start(false);
|
block_txn_start(false);
|
||||||
|
|
||||||
@ -283,7 +283,7 @@ block BlockchainDB::get_block_from_height(const uint64_t& height) const
|
|||||||
blobdata bd = get_block_blob_from_height(height);
|
blobdata bd = get_block_blob_from_height(height);
|
||||||
block b;
|
block b;
|
||||||
if (!parse_and_validate_block_from_blob(bd, b))
|
if (!parse_and_validate_block_from_blob(bd, b))
|
||||||
throw new DB_ERROR("Failed to parse block from blob retrieved from the db");
|
throw DB_ERROR("Failed to parse block from blob retrieved from the db");
|
||||||
|
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
@ -293,7 +293,7 @@ block BlockchainDB::get_block(const crypto::hash& h) const
|
|||||||
blobdata bd = get_block_blob(h);
|
blobdata bd = get_block_blob(h);
|
||||||
block b;
|
block b;
|
||||||
if (!parse_and_validate_block_from_blob(bd, b))
|
if (!parse_and_validate_block_from_blob(bd, b))
|
||||||
throw new DB_ERROR("Failed to parse block from blob retrieved from the db");
|
throw DB_ERROR("Failed to parse block from blob retrieved from the db");
|
||||||
|
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
@ -304,7 +304,7 @@ bool BlockchainDB::get_tx(const crypto::hash& h, cryptonote::transaction &tx) co
|
|||||||
if (!get_tx_blob(h, bd))
|
if (!get_tx_blob(h, bd))
|
||||||
return false;
|
return false;
|
||||||
if (!parse_and_validate_tx_from_blob(bd, tx))
|
if (!parse_and_validate_tx_from_blob(bd, tx))
|
||||||
throw new DB_ERROR("Failed to parse transaction from blob retrieved from the db");
|
throw DB_ERROR("Failed to parse transaction from blob retrieved from the db");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -313,7 +313,7 @@ transaction BlockchainDB::get_tx(const crypto::hash& h) const
|
|||||||
{
|
{
|
||||||
transaction tx;
|
transaction tx;
|
||||||
if (!get_tx(h, tx))
|
if (!get_tx(h, tx))
|
||||||
throw new TX_DNE(std::string("tx with hash ").append(epee::string_tools::pod_to_hex(h)).append(" not found in db").c_str());
|
throw TX_DNE(std::string("tx with hash ").append(epee::string_tools::pod_to_hex(h)).append(" not found in db").c_str());
|
||||||
return tx;
|
return tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,7 +471,7 @@ bool Blockchain::deinit()
|
|||||||
// memory operation), otherwise we may cause a loop.
|
// memory operation), otherwise we may cause a loop.
|
||||||
if (m_db == NULL)
|
if (m_db == NULL)
|
||||||
{
|
{
|
||||||
throw new DB_ERROR("The db pointer is null in Blockchain, the blockchain may be corrupt!");
|
throw DB_ERROR("The db pointer is null in Blockchain, the blockchain may be corrupt!");
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
Loading…
Reference in New Issue
Block a user