mdbx: fix posix mdbx_lck_destroy().

This commit is contained in:
Leo Yuriev
2017-04-05 16:34:19 +03:00
parent f51c8dae72
commit fcb63130d6
2 changed files with 7 additions and 3 deletions

View File

@@ -89,7 +89,7 @@ bailout:
void mdbx_lck_destroy(MDB_env *env) {
if (env->me_lfd != INVALID_HANDLE_VALUE) {
/* try get exclusive access */
if (mdbx_lck_op(env->me_lfd, F_SETLK, F_WRLCK, 0) == 0) {
if (env->me_txns && mdbx_lck_op(env->me_lfd, F_SETLK, F_WRLCK, 0) == 0) {
/* got exclusive, drown mutexes */
int rc = pthread_mutex_destroy(&env->me_txns->mti_rmutex);
if (rc == 0)