Merge pull request #1 from LMDB/crash-fix

Tweak 45800a25e9
This commit is contained in:
moneromooo-monero 2015-12-29 00:11:46 +00:00
commit 3b56036bb3
1 changed files with 5 additions and 5 deletions

View File

@ -131,15 +131,15 @@ template<>
struct MDB_val_copy<const char*>: public MDB_val
{
MDB_val_copy(const char *s):
len(strlen(s)),
data(new char[len+1])
size(strlen(s)+1), // include the NUL, makes it easier for compares
data(new char[size])
{
memcpy(data.get(), s, len+1);
mv_size = len + 1; // include the NUL, makes it easier for compares
mv_size = size;
mv_data = data.get();
memcpy(mv_data, s, size);
}
private:
size_t len;
size_t size;
std::unique_ptr<char[]> data;
};