Win32: fix environment memory leaks