summaryrefslogtreecommitdiff
path: root/os-win32.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-12-14 07:59:21 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2011-12-14 07:59:21 -0600
commit9423a2e8dd362a271bfe194ec131062814557b95 (patch)
tree6b10b2d69e5d81b6ff4cb2ba75693d8a65362d92 /os-win32.c
parentda5361cc685c004d8bb4e7c5e7b3a52c7aca2c56 (diff)
parent126c79133f77d1b0b7c3849899c6d5f83b2fd410 (diff)
downloadqemu-9423a2e8dd362a271bfe194ec131062814557b95.tar.gz
Merge remote-tracking branch 'stefanha/trivial-patches-next' into staging
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 8ad5fa1fc3..8523d8d0c4 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;
}