mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-13 13:26:01 +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,
|
||||
const std::string &value, size_t offset, size_t len) {
|
||||
std::unique_ptr<VariableOrigin> origin(new VariableOrigin());
|
||||
std::string *v = new std::string(value);
|
||||
VariableValue *var = new VariableValue(&m_name, &key, v);
|
||||
delete v;
|
||||
VariableValue *var = new VariableValue(&m_name, &key, &value);
|
||||
|
||||
origin->m_offset = offset;
|
||||
origin->m_length = len;
|
||||
@ -68,9 +66,7 @@ void AnchoredSetVariable::set(const std::string &key,
|
||||
void AnchoredSetVariable::set(const std::string &key,
|
||||
const std::string &value, size_t offset) {
|
||||
std::unique_ptr<VariableOrigin> origin(new VariableOrigin());
|
||||
std::string *v = new std::string(value);
|
||||
VariableValue *var = new VariableValue(&m_name, &key, v);
|
||||
delete v;
|
||||
VariableValue *var = new VariableValue(&m_name, &key, &value);
|
||||
|
||||
origin->m_offset = offset;
|
||||
origin->m_length = value.size();
|
||||
|
Loading…
x
Reference in New Issue
Block a user