mdbx: fix null-deref in an ASAN-enabled build while opening DB with error.

More for https://github.com/erthink/libmdbx/issues/95

Change-Id: I6250fe7b0fbbcae497c2b5c1da9b4e9f78ecf0f0
This commit is contained in:
Leonid Yuriev 2020-04-11 14:52:49 +03:00
parent 17d7d48281
commit c590eb656f

View File

@ -10148,12 +10148,13 @@ int __cold mdbx_env_open(MDBX_env *env, const char *pathname, unsigned flags,
#endif
bailout:
#if defined(MDBX_USE_VALGRIND) || defined(__SANITIZE_ADDRESS__)
mdbx_txn_valgrind(env, nullptr);
#endif
if (rc) {
if (rc != MDBX_SUCCESS) {
rc = mdbx_env_close0(env) ? MDBX_PANIC : rc;
env->me_flags = saved_me_flags | MDBX_FATAL_ERROR;
} else {
#if defined(MDBX_USE_VALGRIND) || defined(__SANITIZE_ADDRESS__)
mdbx_txn_valgrind(env, nullptr);
#endif
}
mdbx_free(lck_pathname);
return rc;