From: Hallvard Furuseth Date: Thu, 13 Jun 2013 06:58:24 +0000 (+0200) Subject: ITS#7594 Invalidate a dropped MDB DB's cursors. X-Git-Tag: OPENLDAP_REL_ENG_2_4_36~36^2~19 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2bacf6e59ed4510d2540d758c3b079406853b18a;p=openldap ITS#7594 Invalidate a dropped MDB DB's cursors. --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 940335730b..2791e798e7 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -7450,7 +7450,7 @@ mdb_drop0(MDB_cursor *mc, int subs) int mdb_drop(MDB_txn *txn, MDB_dbi dbi, int del) { - MDB_cursor *mc; + MDB_cursor *mc, *m2; int rc; if (!txn || !dbi || dbi >= txn->mt_numdbs || (unsigned)del > 1 || !(txn->mt_dbflags[dbi] & DB_VALID)) @@ -7464,6 +7464,9 @@ int mdb_drop(MDB_txn *txn, MDB_dbi dbi, int del) return rc; rc = mdb_drop0(mc, mc->mc_db->md_flags & MDB_DUPSORT); + /* Invalidate the dropped DB's cursors */ + for (m2 = mc->mc_txn->mt_cursors[dbi]; m2; m2 = m2->mc_next) + m2->mc_flags &= ~C_INITIALIZED; if (rc) goto leave;