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:
Eduardo Arias
2024-09-10 14:32:38 -03:00
parent b7b2d9a40d
commit 75d31a4d1e
4 changed files with 13 additions and 34 deletions

View File

@@ -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;
}