mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
Remove unneeded heap allocation in AnchoredSetVariable::set
This commit is contained in:
parent
dc6cce5f0c
commit
fd67c6eb1d
@ -53,9 +53,7 @@ void AnchoredSetVariable::unset() {
|
|||||||
void AnchoredSetVariable::set(const std::string &key,
|
void AnchoredSetVariable::set(const std::string &key,
|
||||||
const std::string &value, size_t offset, size_t len) {
|
const std::string &value, size_t offset, size_t len) {
|
||||||
std::unique_ptr<VariableOrigin> origin(new VariableOrigin());
|
std::unique_ptr<VariableOrigin> origin(new VariableOrigin());
|
||||||
std::string *v = new std::string(value);
|
VariableValue *var = new VariableValue(&m_name, &key, &value);
|
||||||
VariableValue *var = new VariableValue(&m_name, &key, v);
|
|
||||||
delete v;
|
|
||||||
|
|
||||||
origin->m_offset = offset;
|
origin->m_offset = offset;
|
||||||
origin->m_length = len;
|
origin->m_length = len;
|
||||||
@ -68,9 +66,7 @@ void AnchoredSetVariable::set(const std::string &key,
|
|||||||
void AnchoredSetVariable::set(const std::string &key,
|
void AnchoredSetVariable::set(const std::string &key,
|
||||||
const std::string &value, size_t offset) {
|
const std::string &value, size_t offset) {
|
||||||
std::unique_ptr<VariableOrigin> origin(new VariableOrigin());
|
std::unique_ptr<VariableOrigin> origin(new VariableOrigin());
|
||||||
std::string *v = new std::string(value);
|
VariableValue *var = new VariableValue(&m_name, &key, &value);
|
||||||
VariableValue *var = new VariableValue(&m_name, &key, v);
|
|
||||||
delete v;
|
|
||||||
|
|
||||||
origin->m_offset = offset;
|
origin->m_offset = offset;
|
||||||
origin->m_length = value.size();
|
origin->m_length = value.size();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user