mirror of
https://github.com/isar/libmdbx.git
synced 2024-10-30 11:29:19 +08:00
mdbx: fix segfault and double-free (in case twice abortion of the same write-txn).
This commit is contained in:
parent
96de36baef
commit
b9dbe7c577
@ -2345,6 +2345,7 @@ uint64_t mdbx_txn_id(MDBX_txn *txn) {
|
||||
/* Export or close DBI handles opened in this txn. */
|
||||
static void mdbx_dbis_update(MDBX_txn *txn, int keep) {
|
||||
MDBX_dbi n = txn->mt_numdbs;
|
||||
if (n) {
|
||||
MDBX_env *env = txn->mt_env;
|
||||
uint8_t *tdbflags = txn->mt_dbflags;
|
||||
|
||||
@ -2367,6 +2368,7 @@ static void mdbx_dbis_update(MDBX_txn *txn, int keep) {
|
||||
if (keep && env->me_numdbs < n)
|
||||
env->me_numdbs = n;
|
||||
}
|
||||
}
|
||||
|
||||
/* End a transaction, except successful commit of a nested transaction.
|
||||
* May be called twice for readonly txns: First reset it, then abort.
|
||||
@ -2447,6 +2449,7 @@ static int mdbx_txn_end(MDBX_txn *txn, unsigned mode) {
|
||||
|
||||
if (mode & MDBX_END_FREE) {
|
||||
txn->mt_signature = 0;
|
||||
if (txn != env->me_txn0)
|
||||
free(txn);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user