mdbx: check txn inside mdbx_cursor_txn().

Change-Id: Ia3d24800890369e3b6cab23d8f69c27246a4f017
This commit is contained in:
Leo Yuriev 2018-01-11 21:43:54 +03:00
parent 6b5533338f
commit c4007cbc70

View File

@ -8184,7 +8184,12 @@ void mdbx_cursor_close(MDBX_cursor *mc) {
MDBX_txn *mdbx_cursor_txn(MDBX_cursor *mc) {
if (unlikely(!mc || mc->mc_signature != MDBX_MC_SIGNATURE))
return NULL;
return mc->mc_txn;
MDBX_txn *txn = mc->mc_txn;
if (unlikely(!txn || txn->mt_signature != MDBX_MT_SIGNATURE))
return NULL;
if (unlikely(txn->mt_flags & MDBX_TXN_FINISHED))
return NULL;
return txn;
}
MDBX_dbi mdbx_cursor_dbi(MDBX_cursor *mc) {