diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-12-28 19:23:02 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-12-28 19:23:02 +0000 |
commit | 78b65cf7e8089d370aa7e8b481ccce8a3b9cd4af (patch) | |
tree | 7cdf72ccbc6e01be106bb3a176cf020395d589a9 /src | |
parent | db_lmdb: fix a strdup/delete[] mistmatch (diff) | |
download | monero-78b65cf7e8089d370aa7e8b481ccce8a3b9cd4af.tar.xz |
db_lmdb: safety close db at exit
Noticed by hyc
Also set m_open to false when closed
Diffstat (limited to 'src')
-rw-r--r-- | src/blockchain_db/lmdb/db_lmdb.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp index ded648cae..85eaf4569 100644 --- a/src/blockchain_db/lmdb/db_lmdb.cpp +++ b/src/blockchain_db/lmdb/db_lmdb.cpp @@ -926,6 +926,8 @@ BlockchainLMDB::~BlockchainLMDB() // batch transaction shouldn't be active at this point. If it is, consider it aborted. if (m_batch_active) batch_abort(); + if (m_open) + close(); } BlockchainLMDB::BlockchainLMDB(bool batch_transactions) @@ -1156,6 +1158,7 @@ void BlockchainLMDB::close() // FIXME: not yet thread safe!!! Use with care. mdb_env_close(m_env); + m_open = false; } void BlockchainLMDB::sync() |