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)
{
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);
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));