From 4085ff553624121d6cd76d20064394e4d6d21c1a Mon Sep 17 00:00:00 2001 From: Ervin Hegedus Date: Wed, 27 Mar 2024 13:14:11 +0100 Subject: [PATCH] Replace putenv by setenv --- test/regression/regression.cc | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/test/regression/regression.cc b/test/regression/regression.cc index 1a6b764669..56eb43c80f 100644 --- a/test/regression/regression.cc +++ b/test/regression/regression.cc @@ -474,11 +474,9 @@ int main(int argc, char **argv) { ModSecurityTest test; std::string ver(MODSECURITY_VERSION); - std::string envvar("MODSECURITY=ModSecurity " + ver + " regression tests"); + std::string envvar("ModSecurity " + ver + " regression tests"); - char *envvarptr = strdup(envvar.c_str()); - - putenv(envvarptr); + setenv("MODSECURITY", envvar.c_str(), 1); #ifndef NO_LOGS int test_number = 0; #endif @@ -538,9 +536,6 @@ int main(int argc, char **argv) { if (test.m_count_all) { std::cout << std::to_string(keyList.size()) << std::endl; - if (envvarptr != nullptr) { - free(envvarptr); - } exit(0); } @@ -611,9 +606,6 @@ int main(int argc, char **argv) { } #endif - if (envvarptr != nullptr) { - free(envvarptr); - } return 0; }