summaryrefslogtreecommitdiffstats
path: root/os-win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'os-win32.c')
-rw-r--r--os-win32.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/os-win32.c b/os-win32.c
index 8ad5fa1..8523d8d 100644
--- a/os-win32.c
+++ b/os-win32.c
@@ -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;
}
OpenPOWER on IntegriCloud