Skip to content

Commit e764d2c

Browse files
committed
Try to recover from closing a freed cursor
1 parent 447c167 commit e764d2c

File tree

1 file changed

+5
-0
lines changed
  • dependencies/lmdb/libraries/liblmdb

1 file changed

+5
-0
lines changed

dependencies/lmdb/libraries/liblmdb/mdb.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10357,6 +10357,11 @@ void
1035710357
mdb_cursor_close(MDB_cursor *mc)
1035810358
{
1035910359
if (mc) {
10360+
if (!mc->mc_txn || !mc->mc_txn->mt_env) {
10361+
fprintf(stderr, "cursor_close: mc->mc_txn or mc->mc_txn->mt_env is NULL, ensure that cursors are closed before the transaction is closed\n");
10362+
free(mc);
10363+
return;
10364+
}
1036010365
MDB_CURSOR_UNREF(mc, 0);
1036110366
}
1036210367
if (mc && !mc->mc_backup) {

0 commit comments

Comments
 (0)