From bbb27cde4af7d9f60ca77b4b0caea4b6237ed289 Mon Sep 17 00:00:00 2001 From: Claude Brisson Date: Fri, 22 Mar 2013 16:00:21 +0100 Subject: [PATCH] bugfix for mdb_cursor_put with MDB_MULTIPLE If the variable dkey.mv_size is non-zero, then it means dkey contains some original data which has to be put back in the child db, typically when the child db has just been created. But when using MDB_MULTIPLE, if this variable has not been reset to zero, we may come back to this section and wrongly think that there is some original data to be taken care of. --- libraries/liblmdb/mdb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index cf306fc..3329565 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -5218,6 +5218,8 @@ put_sub: } } } + /* we've done our job */ + dkey.mv_size = 0; } if (flags & MDB_APPENDDUP) xflags |= MDB_APPEND;