Skip to content

Commit

Permalink
Merge pull request monero-project#955
Browse files Browse the repository at this point in the history
7442dd0 More for Issue monero-project#855 (Howard Chu)
  • Loading branch information
fluffypony committed Aug 11, 2016
2 parents 0faf572 + 7442dd0 commit 45f4ef7
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions external/db_drivers/liblmdb/mdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -6599,8 +6599,14 @@ mdb_cursor_set(MDB_cursor *mc, MDB_val *key, MDB_val *data,
if (key->mv_size == 0)
return MDB_BAD_VALSIZE;

if (mc->mc_xcursor)
if (mc->mc_xcursor) {
#ifdef MDB_VL32
if (mc->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED) {
mdb_cursor_unref(&mc->mc_xcursor->mx_cursor);
}
#endif
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) {
Expand Down Expand Up @@ -6732,11 +6738,6 @@ mdb_cursor_set(MDB_cursor *mc, MDB_val *key, MDB_val *data,
return MDB_SUCCESS;
}

#ifdef MDB_VL32
if (mc->mc_xcursor && mc->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED) {
mdb_cursor_unref(&mc->mc_xcursor->mx_cursor);
}
#endif
if (F_ISSET(leaf->mn_flags, F_DUPDATA)) {
mdb_xcursor_init1(mc, leaf);
}
Expand Down Expand Up @@ -8311,6 +8312,11 @@ mdb_cursor_count(MDB_cursor *mc, mdb_size_t *countp)
void
mdb_cursor_close(MDB_cursor *mc)
{
#ifdef MDB_VL32
if (mc) {
mdb_cursor_unref(mc);
}
#endif
if (mc && !mc->mc_backup) {
/* remove from txn, if tracked */
if ((mc->mc_flags & C_UNTRACK) && mc->mc_txn->mt_cursors) {
Expand Down

0 comments on commit 45f4ef7

Please sign in to comment.