...
In this example derived from Dowd, an automatic variable is used as an argument to putenv(). When that The TEST environment variable is retrieved outside of the function may take on an unintended value if it is accessed once func() has returned and the stack frame where env is declared , it may have an unexpected valuehas been deallocated.
Note that this example also violates rule DCL30-C. Do not refer to an object outside of its lifetime.
...