Workaround VL32 cursor refcounting miscount

Don't try to deref cursor page if txn's pagelist is empty
ntdll
Howard Chu 8 years ago
parent 882e27c1b4
commit 1db9f32ae2
  1. 16
      libraries/liblmdb/mdb.c

@ -2006,13 +2006,15 @@ static void
mdb_cursor_unref(MDB_cursor *mc) mdb_cursor_unref(MDB_cursor *mc)
{ {
int i; int i;
if (!mc->mc_snum || !mc->mc_pg[0] || IS_SUBP(mc->mc_pg[0])) if (mc->mc_txn->mt_rpages[0].mid) {
return; if (!mc->mc_snum || !mc->mc_pg[0] || IS_SUBP(mc->mc_pg[0]))
for (i=0; i<mc->mc_snum; i++) return;
mdb_page_unref(mc->mc_txn, mc->mc_pg[i]); for (i=0; i<mc->mc_snum; i++)
if (mc->mc_ovpg) { mdb_page_unref(mc->mc_txn, mc->mc_pg[i]);
mdb_page_unref(mc->mc_txn, mc->mc_ovpg); if (mc->mc_ovpg) {
mc->mc_ovpg = 0; mdb_page_unref(mc->mc_txn, mc->mc_ovpg);
mc->mc_ovpg = 0;
}
} }
mc->mc_snum = mc->mc_top = 0; mc->mc_snum = mc->mc_top = 0;
mc->mc_pg[0] = NULL; mc->mc_pg[0] = NULL;

Loading…
Cancel
Save