vhbit / lmdb-rs

Rust bindings for LMDB
MIT License
114 stars 47 forks source link

fix double free after commit failure #45

Closed michael-wi closed 7 years ago

michael-wi commented 7 years ago

in commit() function call to ffi::mdb_txn_commit() should be after state change. mdb_txn_commit() will free handle even in failure case. But TransactionState would be still ‘Nomral’ if call fails and is done before state change. Dropping transaction would then cause silent_abort() to call mdb_txn_abort() and free handle again.

vhbit commented 7 years ago

Nice catch! Please include description you've added as a comment to the commit itself.

michael-wi commented 7 years ago

Thanks! Description added to commit.