]> git.sur5r.net Git - openldap/commitdiff
Fix mdb_rebalance
authorHoward Chu <hyc@symas.com>
Wed, 17 Apr 2013 21:33:41 +0000 (14:33 -0700)
committerHoward Chu <hyc@symas.com>
Wed, 17 Apr 2013 21:33:41 +0000 (14:33 -0700)
Don't do anything with (fake root) subpages

libraries/liblmdb/mdb.c

index f25222c9fffb5873a1a540b5568c252e1d14b6a5..b51f6f9ef3c64d64ac26312fff8f96ce595626b9 100644 (file)
@@ -6320,6 +6320,10 @@ mdb_rebalance(MDB_cursor *mc)
 
        if (mc->mc_snum < 2) {
                MDB_page *mp = mc->mc_pg[0];
+               if (IS_SUBP(mp)) {
+                       DPUTS("Can't rebalance a subpage, ignoring");
+                       return MDB_SUCCESS;
+               }
                if (NUMKEYS(mp) == 0) {
                        DPUTS("tree is completely empty");
                        mc->mc_db->md_root = P_INVALID;