Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
4.2.0
-
None
-
Resource Leak
Description
rw_putenv() uses putenv() to add variables to the environment. Unfortunately putenv() actually places the user provided string into the environment, so the string cannot be deallocated immediately. The result is false positive memory leaks in tests that use rw_putenv().
One solution would be to use setenv() and unsetenv() on platforms that support them. This avoids the memory leak. Another option would be to have rw_putenv() track the environment strings that were added, then remove and deallocate them when the test driver is taken down.