From f4cab2994f45b56fd5ffa1f332850b0e3285b665 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 23 Apr 2015 05:49:56 +0100 Subject: [PATCH] ITS#8109 fix mdb_cursor_del0 on empty DB --- libraries/liblmdb/mdb.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 4e0607f..f1c7508 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -7963,6 +7963,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);