From: Hallvard Furuseth Date: Mon, 22 Apr 2013 18:46:56 +0000 (+0200) Subject: Plug mdb_cursor_renew() memleak X-Git-Tag: OPENLDAP_REL_ENG_2_4_36~69^2~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=37bd48a618b62f72029dcd03e0a2ee91c8e7713c;p=openldap Plug mdb_cursor_renew() memleak --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 30475ac7e5..83dcb2506b 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -5840,13 +5840,19 @@ mdb_cursor_open(MDB_txn *txn, MDB_dbi dbi, MDB_cursor **ret) int mdb_cursor_renew(MDB_txn *txn, MDB_cursor *mc) { + unsigned flags; + if (txn == NULL || mc == NULL || mc->mc_dbi >= txn->mt_numdbs) return EINVAL; if (txn->mt_cursors) return EINVAL; + flags = mc->mc_flags; + mdb_cursor_init(mc, txn, mc->mc_dbi, mc->mc_xcursor); + + mc->mc_flags |= (flags & C_ALLOCD); return MDB_SUCCESS; }