Skip to content

[lmdb] Update LMDB to latest upstream #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Database/lmdb/COPYRIGHT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2011-2018 Howard Chu, Symas Corp.
Copyright 2011-2021 Howard Chu, Symas Corp.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
10 changes: 6 additions & 4 deletions lib/Database/lmdb/lmdb++.h
Original file line number Diff line number Diff line change
Expand Up @@ -1276,12 +1276,11 @@ class lmdb::txn {
* @post `handle() == nullptr`
*/
void commit() {
// INDEXSTOREDB START (prevent double free)
MDB_txn *hnd = _handle;
// Clear _handle before the call otherwise if an error is thrown then
// the destructor will do abort() which will be double-free since
// txn_commit will have already freed the handle object.
_handle = nullptr;
lmdb::txn_commit(hnd);
// INDEXSTOREDB END
}

/**
Expand All @@ -1290,8 +1289,11 @@ class lmdb::txn {
* @post `handle() == nullptr`
*/
void abort() noexcept {
lmdb::txn_abort(_handle);
// INDEXSTOREDB START (prevent double free)
MDB_txn *hnd = _handle;
_handle = nullptr;
lmdb::txn_abort(hnd);
// INDEXSTOREDB END
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/Database/lmdb/lmdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ int mdb_env_create(MDB_env **env);
* <li>#MDB_NOTLS
* Don't use Thread-Local Storage. Tie reader locktable slots to
* #MDB_txn objects instead of to threads. I.e. #mdb_txn_reset() keeps
* the slot reseved for the #MDB_txn object. A thread may use parallel
* the slot reserved for the #MDB_txn object. A thread may use parallel
* read-only transactions. A read-only transaction may span threads if
* the user synchronizes its use. Applications that multiplex many
* user threads over individual OS threads need this option. Such an
Expand Down Expand Up @@ -968,7 +968,7 @@ void *mdb_env_get_userctx(MDB_env *env);
typedef void MDB_assert_func(MDB_env *env, const char *msg);

/** Set or reset the assert() callback of the environment.
* Disabled if liblmdb is buillt with NDEBUG.
* Disabled if liblmdb is built with NDEBUG.
* @note This hack should become obsolete as lmdb's error handling matures.
* @param[in] env An environment handle returned by #mdb_env_create().
* @param[in] func An #MDB_assert_func function, or 0.
Expand Down
Loading