From: Hallvard Furuseth Date: Sun, 16 Mar 2014 11:42:42 +0000 (+0100) Subject: Don't use non-existent node info in branch/leaf2 X-Git-Tag: OPENLDAP_REL_ENG_2_4_40~132^2~27 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=937b5eff07e30563a4b55fdde936191eb64f0f3b;p=openldap Don't use non-existent node info in branch/leaf2 --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 592dae44aa..5309b2fa33 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -2105,6 +2105,7 @@ done: if (m2->mc_pg[mc->mc_top] == mp) { m2->mc_pg[mc->mc_top] = np; if ((mc->mc_db->md_flags & MDB_DUPSORT) && + IS_LEAF(np) && m2->mc_ki[mc->mc_top] == mc->mc_ki[mc->mc_top]) { MDB_node *leaf = NODEPTR(np, mc->mc_ki[mc->mc_top]); @@ -6305,9 +6306,11 @@ mdb_cursor_del(MDB_cursor *mc, unsigned int flags) return rc; mp = mc->mc_pg[mc->mc_top]; + if (IS_LEAF2(mp)) + goto del_key; leaf = NODEPTR(mp, mc->mc_ki[mc->mc_top]); - if (!IS_LEAF2(mp) && F_ISSET(leaf->mn_flags, F_DUPDATA)) { + if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { if (!(flags & MDB_NODUPDATA)) { if (!F_ISSET(leaf->mn_flags, F_SUBDATA)) { mc->mc_xcursor->mx_cursor.mc_pg[0] = NODEDATA(leaf); @@ -6351,7 +6354,7 @@ mdb_cursor_del(MDB_cursor *mc, unsigned int flags) } /* add overflow pages to free list */ - if (!IS_LEAF2(mp) && F_ISSET(leaf->mn_flags, F_BIGDATA)) { + if (F_ISSET(leaf->mn_flags, F_BIGDATA)) { MDB_page *omp; pgno_t pg; @@ -6361,6 +6364,7 @@ mdb_cursor_del(MDB_cursor *mc, unsigned int flags) return rc; } +del_key: return mdb_cursor_del0(mc); }