From 151c416b460b02cd96502a47189cda19ab651ada Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Sat, 4 May 2013 10:03:19 +0200 Subject: [PATCH] Update fixes for dbi_open/close, ITS#7515. Reset me_dbflags[dbi] when closing DBI, to get rid of MDB_VALID flag. mdb_env_close(): Re-fix DB-name memleak. DBIs > me_numdbs may exist. --- libraries/liblmdb/mdb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 7d4383f..96ca73f 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -2003,6 +2003,7 @@ mdb_txn_reset0(MDB_txn *txn) char *ptr = env->me_dbxs[i].md_name.mv_data; env->me_dbxs[i].md_name.mv_data = NULL; env->me_dbxs[i].md_name.mv_size = 0; + env->me_dbflags[i] = 0; free(ptr); } } @@ -3761,7 +3762,7 @@ mdb_env_close(MDB_env *env) if (env == NULL) return; - for (i = env->me_numdbs; --i > MAIN_DBI; ) + for (i = env->me_maxdbs; --i > MAIN_DBI; ) free(env->me_dbxs[i].md_name.mv_data); VGMEMP_DESTROY(env); @@ -7226,6 +7227,7 @@ void mdb_dbi_close(MDB_env *env, MDB_dbi dbi) ptr = env->me_dbxs[dbi].md_name.mv_data; env->me_dbxs[dbi].md_name.mv_data = NULL; env->me_dbxs[dbi].md_name.mv_size = 0; + env->me_dbflags[dbi] = 0; free(ptr); } -- 2.7.4