mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-15 23:55:03 +03:00
Fix memleak in regression.cc
This commit is contained in:
parent
625f9a5300
commit
39848e5564
@ -476,7 +476,9 @@ int main(int argc, char **argv) {
|
|||||||
std::string ver(MODSECURITY_VERSION);
|
std::string ver(MODSECURITY_VERSION);
|
||||||
std::string envvar("MODSECURITY=ModSecurity " + ver + " regression tests");
|
std::string envvar("MODSECURITY=ModSecurity " + ver + " regression tests");
|
||||||
|
|
||||||
putenv(strdup(envvar.c_str()));
|
char *envvarptr = strdup(envvar.c_str());
|
||||||
|
|
||||||
|
putenv(envvarptr);
|
||||||
#ifndef NO_LOGS
|
#ifndef NO_LOGS
|
||||||
int test_number = 0;
|
int test_number = 0;
|
||||||
#endif
|
#endif
|
||||||
@ -536,6 +538,9 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
if (test.m_count_all) {
|
if (test.m_count_all) {
|
||||||
std::cout << std::to_string(keyList.size()) << std::endl;
|
std::cout << std::to_string(keyList.size()) << std::endl;
|
||||||
|
if (envvarptr != nullptr) {
|
||||||
|
free(envvarptr);
|
||||||
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -606,5 +611,9 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
if (envvarptr != nullptr) {
|
||||||
|
free(envvarptr);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user