diff --git a/src/core.c b/src/core.c index db00fc66..0c3d7cbc 100644 --- a/src/core.c +++ b/src/core.c @@ -14877,10 +14877,8 @@ __cold static int env_close(MDBX_env *env) { } #if defined(_WIN32) || defined(_WIN64) - if (env->me_overlapped_fd) { - CloseHandle(env->me_overlapped_fd); - env->me_overlapped_fd = 0; - } + eASSERT(env, !env->me_overlapped_fd || + env->me_overlapped_fd == INVALID_HANDLE_VALUE); if (env->me_data_lock_event != INVALID_HANDLE_VALUE) { CloseHandle(env->me_data_lock_event); env->me_data_lock_event = INVALID_HANDLE_VALUE; diff --git a/src/osal.c b/src/osal.c index 69a0b49f..91276c66 100644 --- a/src/osal.c +++ b/src/osal.c @@ -1155,6 +1155,8 @@ MDBX_INTERNAL_FUNC void osal_ioring_destroy(osal_ioring_t *ior) { osal_memalign_free(ior->pool); osal_free(ior->event_pool); CloseHandle(ior->async_done); + if (ior->overlapped_fd) + CloseHandle(ior->overlapped_fd); #else osal_free(ior->pool); #endif