aboutsummaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-02-02 21:39:03 +0200
committerRiccardo Spagni <ric@spagni.net>2017-02-02 21:39:03 +0200
commitda9174c8ee02a1a9a40cc23a487d58ccc9174d2d (patch)
treeb8145de0d8968e1e1183634e18646010255e4a01 /external
parentMerge pull request #1654 (diff)
parentWorkaround VL32 cursor refcounting miscount (diff)
downloadmonero-da9174c8ee02a1a9a40cc23a487d58ccc9174d2d.tar.xz
Merge pull request #1656
edfd7f6e Workaround VL32 cursor refcounting miscount (Howard Chu)
Diffstat (limited to 'external')
-rw-r--r--external/db_drivers/liblmdb/mdb.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/external/db_drivers/liblmdb/mdb.c b/external/db_drivers/liblmdb/mdb.c
index 32e225163..d778037b0 100644
--- a/external/db_drivers/liblmdb/mdb.c
+++ b/external/db_drivers/liblmdb/mdb.c
@@ -1953,13 +1953,15 @@ static void
mdb_cursor_unref(MDB_cursor *mc)
{
int i;
- if (!mc->mc_snum || !mc->mc_pg[0] || IS_SUBP(mc->mc_pg[0]))
- return;
- for (i=0; i<mc->mc_snum; i++)
- mdb_page_unref(mc->mc_txn, mc->mc_pg[i]);
- if (mc->mc_ovpg) {
- mdb_page_unref(mc->mc_txn, mc->mc_ovpg);
- mc->mc_ovpg = 0;
+ if (mc->mc_txn->mt_rpages[0].mid) {
+ if (!mc->mc_snum || !mc->mc_pg[0] || IS_SUBP(mc->mc_pg[0]))
+ return;
+ for (i=0; i<mc->mc_snum; i++)
+ mdb_page_unref(mc->mc_txn, mc->mc_pg[i]);
+ if (mc->mc_ovpg) {
+ mdb_page_unref(mc->mc_txn, mc->mc_ovpg);
+ mc->mc_ovpg = 0;
+ }
}
mc->mc_snum = mc->mc_top = 0;
mc->mc_pg[0] = NULL;