if (key->mv_size == 0)
return MDB_BAD_VALSIZE;
- if (mc->mc_xcursor)
+ if (mc->mc_xcursor) {
+ MDB_CURSOR_UNREF(&mc->mc_xcursor->mx_cursor, 0);
mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF);
+ }
/* See if we're already on the right page */
if (mc->mc_flags & C_INITIALIZED) {
return MDB_SUCCESS;
}
- if (mc->mc_xcursor)
- MDB_CURSOR_UNREF(&mc->mc_xcursor->mx_cursor, 0);
if (F_ISSET(leaf->mn_flags, F_DUPDATA)) {
mdb_xcursor_init1(mc, leaf);
}
void
mdb_cursor_close(MDB_cursor *mc)
{
+ if (mc) {
+ MDB_CURSOR_UNREF(mc, 0);
+ }
if (mc && !mc->mc_backup) {
/* remove from txn, if tracked */
if ((mc->mc_flags & C_UNTRACK) && mc->mc_txn->mt_cursors) {