Workaround VL32 cursor refcounting miscount

Don't try to deref cursor page if txn's pagelist is empty
This commit is contained in:
Howard Chu 2017-01-31 10:38:12 +00:00
parent 15eb2bcf6f
commit edfd7f6e07
No known key found for this signature in database
GPG Key ID: FD2A70B44AB11BA7
1 changed files with 9 additions and 7 deletions

View File

@ -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;