mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
Fix mdb_env_close(unopened MDB_env).
Do not try to scan me_dbxs in a closed/never-opened MDB_env. Broken by7d643d3acb
and151c416b46
.
This commit is contained in:
parent
0b9a208530
commit
521fdb00cc
@ -3548,7 +3548,7 @@ leave:
|
||||
return rc;
|
||||
}
|
||||
|
||||
/** Destroy resources from mdb_env_open() and clear our readers */
|
||||
/** Destroy resources from mdb_env_open(), clear our readers & DBIs */
|
||||
static void
|
||||
mdb_env_close0(MDB_env *env, int excl)
|
||||
{
|
||||
@ -3557,6 +3557,10 @@ mdb_env_close0(MDB_env *env, int excl)
|
||||
if (!(env->me_flags & MDB_ENV_ACTIVE))
|
||||
return;
|
||||
|
||||
/* Doing this here since me_dbxs may not exist during mdb_env_close */
|
||||
for (i = env->me_maxdbs; --i > MAIN_DBI; )
|
||||
free(env->me_dbxs[i].md_name.mv_data);
|
||||
|
||||
free(env->me_dbflags);
|
||||
free(env->me_dbxs);
|
||||
free(env->me_path);
|
||||
@ -3764,14 +3768,10 @@ void
|
||||
mdb_env_close(MDB_env *env)
|
||||
{
|
||||
MDB_page *dp;
|
||||
int i;
|
||||
|
||||
if (env == NULL)
|
||||
return;
|
||||
|
||||
for (i = env->me_maxdbs; --i > MAIN_DBI; )
|
||||
free(env->me_dbxs[i].md_name.mv_data);
|
||||
|
||||
VGMEMP_DESTROY(env);
|
||||
while ((dp = env->me_dpages) != NULL) {
|
||||
VGMEMP_DEFINED(&dp->mp_next, sizeof(dp->mp_next));
|
||||
|
Loading…
Reference in New Issue
Block a user