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

Fixes https://github.com/erthink/libmdbx/issues/95

Change-Id: I1c000d3a456897f73367a590ef9fbda8ae90391c
This commit is contained in:
Leonid Yuriev 2020-04-11 03:06:05 +03:00
parent 9b94e45e25
commit 17d7d48281

View File

@ -5771,6 +5771,9 @@ static void mdbx_txn_valgrind(MDBX_env *env, MDBX_txn *txn) {
/* inside write-txn */
MDBX_meta *head = mdbx_meta_head(env);
last = head->mm_geo.next;
} else if (env->me_flags & MDBX_RDONLY) {
/* read-only mode, no write-txn, no wlock mutex */
last = NUM_METAS;
} else if (mdbx_txn_lock(env, true) == MDBX_SUCCESS) {
/* no write-txn */
last = NUM_METAS;