From 4d3e349c16760807ad1681f6af014ab9856289ea Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Sat, 7 May 2016 23:42:50 +0300 Subject: [PATCH] mdbx: don't memcpy when src eq dest. Workaround for 'destination overlaps source' from Valgrind. Change-Id: Ib12eacbd224057334311816346ea0ccece2b42cf --- mdb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mdb.c b/mdb.c index 97061ddf..c8f3a0fe 100644 --- a/mdb.c +++ b/mdb.c @@ -7383,14 +7383,14 @@ update: memcpy(ndata, data->mv_data, sizeof(pgno_t)); else if (F_ISSET(flags, MDB_RESERVE)) data->mv_data = ndata; - else + else if (ndata != data->mv_data) memcpy(ndata, data->mv_data, data->mv_size); } else { memcpy(ndata, &ofp->mp_pgno, sizeof(pgno_t)); ndata = PAGEDATA(ofp); if (F_ISSET(flags, MDB_RESERVE)) data->mv_data = ndata; - else + else if (ndata != data->mv_data) memcpy(ndata, data->mv_data, data->mv_size); } }