From: Howard Chu Date: Thu, 23 Apr 2015 04:49:56 +0000 (+0100) Subject: ITS#8109 fix mdb_cursor_del0 on empty DB X-Git-Tag: LMDB_0.9.15~16 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b7511480c50e3a6099e223a8940fea501f5b6d2c;p=openldap ITS#8109 fix mdb_cursor_del0 on empty DB --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index cc87f19def..fe651509f8 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -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);