mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-15 23:55:03 +03:00
Fix lmdb collections backend
This commit is contained in:
parent
b12cc91289
commit
e181cb7e0a
@ -188,6 +188,7 @@ std::string* LMDB::resolveFirst(const std::string& var) {
|
|||||||
goto end_get;
|
goto end_get;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//FIXME: Memory leak here.
|
||||||
ret = new std::string(
|
ret = new std::string(
|
||||||
reinterpret_cast<char *>(mdb_value_ret.mv_data),
|
reinterpret_cast<char *>(mdb_value_ret.mv_data),
|
||||||
mdb_value_ret.mv_size);
|
mdb_value_ret.mv_size);
|
||||||
@ -289,7 +290,9 @@ void LMDB::resolveSingleMatch(const std::string& var,
|
|||||||
std::string *a = new std::string(
|
std::string *a = new std::string(
|
||||||
reinterpret_cast<char *>(mdb_value_ret.mv_data),
|
reinterpret_cast<char *>(mdb_value_ret.mv_data),
|
||||||
mdb_value_ret.mv_size);
|
mdb_value_ret.mv_size);
|
||||||
l->push_back(new Variable(var, *a));
|
Variable *v = new Variable(&var, a);
|
||||||
|
v->m_dynamic_value = true;
|
||||||
|
l->push_back(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
mdb_cursor_close(cursor);
|
mdb_cursor_close(cursor);
|
||||||
@ -502,10 +505,13 @@ void LMDB::resolveMultiMatches(const std::string& var,
|
|||||||
if (strncmp(var.c_str(), a, keySize) != 0) {
|
if (strncmp(var.c_str(), a, keySize) != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
l->insert(l->begin(), new Variable(
|
Variable *v = new Variable(
|
||||||
std::string(reinterpret_cast<char *>(key.mv_data), key.mv_size),
|
new std::string(reinterpret_cast<char *>(key.mv_data),
|
||||||
std::string(reinterpret_cast<char *>(data.mv_data),
|
key.mv_size),
|
||||||
data.mv_size)));
|
new std::string(reinterpret_cast<char *>(data.mv_data),
|
||||||
|
data.mv_size));
|
||||||
|
v->m_dynamic_value = true;
|
||||||
|
l->insert(l->begin(), v);
|
||||||
}
|
}
|
||||||
|
|
||||||
mdb_cursor_close(cursor);
|
mdb_cursor_close(cursor);
|
||||||
@ -593,10 +599,13 @@ void LMDB::resolveRegularExpression(const std::string& var,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
l->insert(l->begin(), new Variable(
|
Variable *v = new Variable(
|
||||||
std::string(reinterpret_cast<char *>(key.mv_data), key.mv_size),
|
new std::string(reinterpret_cast<char *>(key.mv_data),
|
||||||
std::string(reinterpret_cast<char *>(data.mv_data),
|
key.mv_size),
|
||||||
data.mv_size)));
|
new std::string(reinterpret_cast<char *>(data.mv_data),
|
||||||
|
data.mv_size));
|
||||||
|
v->m_dynamic_value = true;
|
||||||
|
l->insert(l->begin(), v);
|
||||||
}
|
}
|
||||||
|
|
||||||
mdb_cursor_close(cursor);
|
mdb_cursor_close(cursor);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user