File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -476,7 +476,9 @@ int main(int argc, char **argv) {
476476 std::string ver (MODSECURITY_VERSION);
477477 std::string envvar (" MODSECURITY=ModSecurity " + ver + " regression tests" );
478478
479- putenv (strdup (envvar.c_str ()));
479+ char *envvarptr = strdup (envvar.c_str ());
480+
481+ putenv (envvarptr);
480482#ifndef NO_LOGS
481483 int test_number = 0 ;
482484#endif
@@ -536,6 +538,9 @@ int main(int argc, char **argv) {
536538
537539 if (test.m_count_all ) {
538540 std::cout << std::to_string (keyList.size ()) << std::endl;
541+ if (envvarptr != nullptr ) {
542+ free (envvarptr);
543+ }
539544 exit (0 );
540545 }
541546
@@ -606,5 +611,9 @@ int main(int argc, char **argv) {
606611 }
607612
608613#endif
614+ if (envvarptr != nullptr ) {
615+ free (envvarptr);
616+ }
617+
609618 return 0 ;
610619}
You can’t perform that action at this time.
0 commit comments