Skip to content

Commit 5eac09c

Browse files
authored
Merge pull request #172 from bnbarham/update-lmdb
[lmdb] Update LMDB to latest upstream
2 parents 0060a67 + a9cb66b commit 5eac09c

File tree

4 files changed

+141
-111
lines changed

4 files changed

+141
-111
lines changed

lib/Database/lmdb/COPYRIGHT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2011-2018 Howard Chu, Symas Corp.
1+
Copyright 2011-2021 Howard Chu, Symas Corp.
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without

lib/Database/lmdb/lmdb++.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,12 +1276,11 @@ class lmdb::txn {
12761276
* @post `handle() == nullptr`
12771277
*/
12781278
void commit() {
1279+
// INDEXSTOREDB START (prevent double free)
12791280
MDB_txn *hnd = _handle;
1280-
// Clear _handle before the call otherwise if an error is thrown then
1281-
// the destructor will do abort() which will be double-free since
1282-
// txn_commit will have already freed the handle object.
12831281
_handle = nullptr;
12841282
lmdb::txn_commit(hnd);
1283+
// INDEXSTOREDB END
12851284
}
12861285

12871286
/**
@@ -1290,8 +1289,11 @@ class lmdb::txn {
12901289
* @post `handle() == nullptr`
12911290
*/
12921291
void abort() noexcept {
1293-
lmdb::txn_abort(_handle);
1292+
// INDEXSTOREDB START (prevent double free)
1293+
MDB_txn *hnd = _handle;
12941294
_handle = nullptr;
1295+
lmdb::txn_abort(hnd);
1296+
// INDEXSTOREDB END
12951297
}
12961298

12971299
/**

lib/Database/lmdb/lmdb.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ int mdb_env_create(MDB_env **env);
610610
* <li>#MDB_NOTLS
611611
* Don't use Thread-Local Storage. Tie reader locktable slots to
612612
* #MDB_txn objects instead of to threads. I.e. #mdb_txn_reset() keeps
613-
* the slot reseved for the #MDB_txn object. A thread may use parallel
613+
* the slot reserved for the #MDB_txn object. A thread may use parallel
614614
* read-only transactions. A read-only transaction may span threads if
615615
* the user synchronizes its use. Applications that multiplex many
616616
* user threads over individual OS threads need this option. Such an
@@ -968,7 +968,7 @@ void *mdb_env_get_userctx(MDB_env *env);
968968
typedef void MDB_assert_func(MDB_env *env, const char *msg);
969969

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

0 commit comments

Comments
 (0)