Skip to content

Commit

Permalink
blockchain_blackball: catch failure to commit db transaction
Browse files Browse the repository at this point in the history
Coverity 188349
  • Loading branch information
moneromooo-monero committed Sep 27, 2018
1 parent 661439f commit e67016d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/blockchain_utilities/blockchain_blackball.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,8 @@ static bool for_all_transactions(const std::string &filename, uint64_t &start_id
}

mdb_cursor_close(cur);
mdb_txn_commit(txn);
dbr = mdb_txn_commit(txn);
if (dbr) throw std::runtime_error("Failed to commit db transaction: " + std::string(mdb_strerror(dbr)));
tx_active = false;
mdb_dbi_close(env, dbi);
mdb_env_close(env);
Expand Down Expand Up @@ -471,7 +472,8 @@ static uint64_t find_first_diverging_transaction(const std::string &first_filena
for (int i = 0; i < 2; ++i)
{
mdb_cursor_close(cur[i]);
mdb_txn_commit(txn[i]);
dbr = mdb_txn_commit(txn[i]);
if (dbr) throw std::runtime_error("Failed to query transaction: " + std::string(mdb_strerror(dbr)));
tx_active[i] = false;
mdb_dbi_close(env[i], dbi[i]);
mdb_env_close(env[i]);
Expand Down

0 comments on commit e67016d

Please sign in to comment.