]> git.sur5r.net Git - openldap/commitdiff
ITS#8109 fix mdb_cursor_del0 on empty DB
authorHoward Chu <hyc@openldap.org>
Thu, 23 Apr 2015 04:49:56 +0000 (05:49 +0100)
committerHoward Chu <hyc@openldap.org>
Thu, 23 Apr 2015 04:50:48 +0000 (05:50 +0100)
libraries/liblmdb/mdb.c

index cc87f19def3d6437866204cd246f93ed94bb6355..fe651509f8a1debc766c95fdfeb8a4a48806f677 100644 (file)
@@ -7845,6 +7845,13 @@ mdb_cursor_del0(MDB_cursor *mc)
                MDB_cursor *m2, *m3;
                MDB_dbi dbi = mc->mc_dbi;
 
+               /* DB is totally empty now, just bail out.
+                * Other cursors adjustments were already done
+                * by mdb_rebalance and aren't needed here.
+                */
+               if (!mc->mc_snum)
+                       return rc;
+
                mp = mc->mc_pg[mc->mc_top];
                nkeys = NUMKEYS(mp);