mdbx: don't memcpy when src eq dest.

Workaround for 'destination overlaps source' from Valgrind.

Change-Id: Ib12eacbd224057334311816346ea0ccece2b42cf
This commit is contained in:
Leo Yuriev 2016-05-07 23:42:50 +03:00
parent 8791e3243f
commit 4d3e349c16

4
mdb.c
View File

@ -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);
}
}