diff --git a/CHANGES b/CHANGES index e0295ba8..da4e5ce5 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,7 @@ LMDB 0.9.15 Release Engineering Fix mdb_rebalance collapsing root (ITS#8062) Fix mdb_load with large values (ITS#8066) Fix to retry writes on EINTR (ITS#8106) + Fix mdb_cursor_del on empty DB (ITS#8109) Added workaround for fdatasync bug in ext3fs Build Don't use -fPIC for static lib diff --git a/mdb.c b/mdb.c index 78e5bd84..e447cfce 100644 --- a/mdb.c +++ b/mdb.c @@ -8569,6 +8569,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);