diff options
Diffstat (limited to 'os-win32.c')
-rw-r--r-- | os-win32.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -44,6 +44,13 @@ int setenv(const char *name, const char *value, int overwrite) char *string = g_malloc(length); snprintf(string, length, "%s=%s", name, value); result = putenv(string); + + /* Windows takes a copy and does not continue to use our string. + * Therefore it can be safely freed on this platform. POSIX code + * typically has to leak the string because according to the spec it + * becomes part of the environment. + */ + g_free(string); } return result; } |