mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-04 18:24:12 +08:00
mdbx: fix SIGSEGV/invalid-deref/invalid-free inside env_close()
when mdbx_env_open()
failed in re-open case (backport).
Thanks to [@leisim](https://t.me/leisim) for [reporting](https://t.me/libmdbx/3946) this issue.
This commit is contained in:
parent
30f292d496
commit
6139443ef1
@ -7,6 +7,10 @@ Fixes:
|
||||
|
||||
- Fixed insignificant typo of `||` inside `#if` byte-order condition (backport).
|
||||
|
||||
- Fixed`SIGSEGV` or an erroneous call to `free()` in situations where
|
||||
errors occur when reopening by `mdbx_env_open()` of a previously used
|
||||
environment (backport).
|
||||
|
||||
|
||||
## v0.11.13 (Swashplate) at 2022-11-10
|
||||
|
||||
|
@ -13447,9 +13447,10 @@ __cold static int mdbx_env_close0(MDBX_env *env) {
|
||||
}
|
||||
|
||||
if (env->me_dbxs) {
|
||||
for (unsigned i = env->me_numdbs; --i >= CORE_DBS;)
|
||||
for (unsigned i = CORE_DBS; i < env->me_numdbs; ++i)
|
||||
mdbx_free(env->me_dbxs[i].md_name.iov_base);
|
||||
mdbx_free(env->me_dbxs);
|
||||
env->me_numdbs = CORE_DBS;
|
||||
env->me_dbxs = nullptr;
|
||||
}
|
||||
if (env->me_pbuf) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user