mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-18 10:20:35 +03:00
Remove memory leak in lmdb.cc while passing data from MDB_val to VariableValue
- add new VariableValue constructors for rvalue strings - decrease number of memory copies between lmdb and VariableValue
This commit is contained in:
committed by
Felipe Zimmerle
parent
3bfe4b81af
commit
a4798f7f56
@@ -47,6 +47,13 @@ class VariableValue {
|
||||
m_value(value != nullptr?*value:"")
|
||||
{ }
|
||||
|
||||
VariableValue(std::string&& key,
|
||||
std::string&& value)
|
||||
: m_collection(""),
|
||||
m_key(std::move(key)),
|
||||
m_value(std::move(value))
|
||||
{ m_keyWithCollection = m_key; }
|
||||
|
||||
VariableValue(const std::string *collection,
|
||||
const std::string *key,
|
||||
const std::string *value)
|
||||
@@ -56,6 +63,14 @@ class VariableValue {
|
||||
m_value(*value)
|
||||
{ }
|
||||
|
||||
VariableValue(const std::string *collection,
|
||||
std::string&& key,
|
||||
std::string&& value)
|
||||
: m_collection(*collection),
|
||||
m_key(std::move(key)),
|
||||
m_value(std::move(value))
|
||||
{ m_keyWithCollection = m_collection + ":" + m_key; }
|
||||
|
||||
explicit VariableValue(const VariableValue *o) :
|
||||
m_collection(o->m_collection),
|
||||
m_key(o->m_key),
|
||||
|
||||
Reference in New Issue
Block a user