diff options
author | Howard Chu <hyc@symas.com> | 2016-08-11 21:04:36 +0100 |
---|---|---|
committer | Howard Chu <hyc@symas.com> | 2016-08-11 21:04:36 +0100 |
commit | 7442dd084acfcef571c51f53277247c050d1c98b (patch) | |
tree | 68dd1b66353b030461ae0cf6a24658974219c989 /external/db_drivers/liblmdb/mdb.c | |
parent | Merge pull request #953 (diff) | |
download | monero-7442dd084acfcef571c51f53277247c050d1c98b.tar.xz |
More for Issue #855
Plug rpage leak in cursor_set
Diffstat (limited to 'external/db_drivers/liblmdb/mdb.c')
-rw-r--r-- | external/db_drivers/liblmdb/mdb.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/external/db_drivers/liblmdb/mdb.c b/external/db_drivers/liblmdb/mdb.c index 2d8e458f7..32e225163 100644 --- a/external/db_drivers/liblmdb/mdb.c +++ b/external/db_drivers/liblmdb/mdb.c @@ -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) { @@ -6732,11 +6738,6 @@ set1: 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); } @@ -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) { |