From 398b90fb1c50718a28ec9383ca9c08b989dc41a7 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Tue, 3 Dec 2019 15:07:07 +0300 Subject: [PATCH] mdbx: fix Coverity warnings (minor). Change-Id: I15c6c707cdeef55c9ce82fe7d5ed0d86224391f5 --- src/elements/core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/elements/core.c b/src/elements/core.c index b969bfb9..25f4cd3f 100644 --- a/src/elements/core.c +++ b/src/elements/core.c @@ -9206,9 +9206,8 @@ int __cold mdbx_env_close_ex(MDBX_env *env, int dont_sync) { env->me_flags |= MDBX_FATAL_ERROR; #endif /* MDBX_TXN_CHECKPID */ - if ((env->me_flags & (MDBX_RDONLY | MDBX_FATAL_ERROR)) == 0) { - if (env->me_txn0 && env->me_txn0->mt_owner && - env->me_txn0->mt_owner != mdbx_thread_self()) + if ((env->me_flags & (MDBX_RDONLY | MDBX_FATAL_ERROR)) == 0 && env->me_txn0) { + if (env->me_txn0->mt_owner && env->me_txn0->mt_owner != mdbx_thread_self()) return MDBX_BUSY; if (!dont_sync) { #if defined(_WIN32) || defined(_WIN64) @@ -12884,7 +12883,7 @@ static int mdbx_rebalance(MDBX_cursor *mc) { mdbx_cassert(mc, rc || page_numkeys(mc->mc_pg[mc->mc_top]) >= minkeys); return rc; } - } else { + } else if (likely(right)) { /* try merge with right */ mdbx_cassert(mc, page_numkeys(right) >= minkeys); mn.mc_pg[mn.mc_top] = right;