From patchwork Thu Nov 24 08:27:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: os-win32.c : fix memory leak Date: Wed, 23 Nov 2011 22:27:52 -0000 From: Zhi Hui Li X-Patchwork-Id: 127453 Message-Id: To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, stefanha@linux.vnet.ibm.com string is allocated by g_malloc, will not be used after putenv, should be free before return. Signed-off-by: Li Zhi Hui Tested-by: Stefan Weil Reviewed-by: Paolo Bonzini --- os-win32.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) } diff --git a/os-win32.c b/os-win32.c index 8ad5fa1..e6e9143 100644 --- a/os-win32.c +++ b/os-win32.c @@ -44,6 +44,7 @@ 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); + g_free(string); } return result;