mdbx-load: fix DBI-error without -s name option.

Related to https://github.com/erthink/libmdbx/issues/136

Change-Id: I1e634456867f92dc1488a826eabf65ab28e64c1b
This commit is contained in:
Leonid Yuriev 2020-11-15 07:57:15 +03:00
parent 3ed58c281a
commit 74e495569e

View File

@ -771,10 +771,15 @@ int main(int argc, char *argv[]) {
error("mdbx_txn_commit", rc);
goto env_close;
}
rc = mdbx_dbi_close(env, dbi);
if (unlikely(rc != MDBX_SUCCESS)) {
error("mdbx_dbi_close", rc);
goto env_close;
if (subname) {
assert(dbi != MAIN_DBI);
rc = mdbx_dbi_close(env, dbi);
if (unlikely(rc != MDBX_SUCCESS)) {
error("mdbx_dbi_close", rc);
goto env_close;
}
} else {
assert(dbi == MAIN_DBI);
}
/* try read next header */