mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 11:16:33 +03:00
Simplified lifetime management of tests
- Addresses Sonarcloud issues: - Rewrite the code so that you no longer need this "delete". - Make the type of this variable a reference-to-const.
This commit is contained in:
@@ -250,8 +250,8 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
for (auto& [filename, tests] : test) {
|
||||
total += tests->size();
|
||||
for (auto t : *tests) {
|
||||
total += tests.size();
|
||||
for (auto &t : tests) {
|
||||
ModSecurityTestResults<UnitTest> r;
|
||||
|
||||
if (!test.m_automake_output) {
|
||||
@@ -311,12 +311,5 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
for (auto a : test) {
|
||||
auto vec = a.second;
|
||||
for(auto t : *vec)
|
||||
delete t;
|
||||
delete vec;
|
||||
}
|
||||
|
||||
return failed;
|
||||
}
|
||||
|
Reference in New Issue
Block a user