db_lmdb: fix a strdup/delete[] mistmatch
This commit is contained in:
parent
95ceb715dc
commit
45800a25e9
|
@ -130,13 +130,16 @@ private:
|
||||||
template<>
|
template<>
|
||||||
struct MDB_val_copy<const char*>: public MDB_val
|
struct MDB_val_copy<const char*>: public MDB_val
|
||||||
{
|
{
|
||||||
MDB_val_copy(const char *s) :
|
MDB_val_copy(const char *s):
|
||||||
data(strdup(s))
|
len(strlen(s)),
|
||||||
|
data(new char[len+1])
|
||||||
{
|
{
|
||||||
mv_size = strlen(s) + 1; // include the NUL, makes it easier for compares
|
memcpy(data.get(), s, len+1);
|
||||||
|
mv_size = len + 1; // include the NUL, makes it easier for compares
|
||||||
mv_data = data.get();
|
mv_data = data.get();
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
|
size_t len;
|
||||||
std::unique_ptr<char[]> data;
|
std::unique_ptr<char[]> data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue