summary refs log tree commit diff
path: root/src/Cache.cpp
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2023-10-25 15:38:13 +0000
committerGitHub <noreply@github.com>2023-10-25 15:38:13 +0000
commit7dd90ed6f07275c5f1476470bcfa0fd27480be32 (patch)
tree0174b933825ce4b89b98b93d4b94ed08f00a6e1c /src/Cache.cpp
parentprevent overscroll in roomlist and communities list (diff)
parentFix double free on commit database migration (diff)
downloadnheko-7dd90ed6f07275c5f1476470bcfa0fd27480be32.tar.xz
Merge pull request #1594 from mips64-el/master
Fix double free on commit database migration
Diffstat (limited to 'src/Cache.cpp')
-rw-r--r--src/Cache.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Cache.cpp b/src/Cache.cpp

index 8ad850ac..bfe27c30 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp
@@ -1727,12 +1727,14 @@ Cache::runMigrations() auto txn = lmdb::txn::begin(env_, nullptr); auto mainDb = lmdb::dbi::open(txn); auto dbNames = lmdb::cursor::open(txn, mainDb); + bool doCommit = false; std::string_view dbName; while (dbNames.get(dbName, MDB_NEXT)) { if (!dbName.starts_with("olm_sessions.v2/")) continue; + doCommit = true; auto curveKey = dbName; curveKey.remove_prefix(std::string_view("olm_sessions.v2/").size()); @@ -1750,7 +1752,7 @@ Cache::runMigrations() oldDb.drop(txn, true); } - txn.commit(); + if (doCommit) txn.commit(); } catch (const lmdb::error &e) { nhlog::db()->critical("Failed to convert olm sessions database in migration! {}", e.what());