qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] os-win32.c : fix memory leak
@ 2011-11-24  8:27 Zhi Hui Li
  2011-11-24  9:15 ` Mark
  2011-11-28 10:49 ` Stefan Hajnoczi
  0 siblings, 2 replies; 7+ messages in thread
From: Zhi Hui Li @ 2011-11-24  8:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, stefanha

[-- Attachment #1: Type: text/plain, Size: 609 bytes --]

string is allocated by g_malloc, will not be used after putenv, should be
free before return.

Signed-off-by: Li Zhi Hui <zhihuili@linux.vnet.ibm.com>
---
 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;
 }
-- 
1.7.4.1

[-- Attachment #2: Type: text/html, Size: 753 bytes --]

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-11-28 10:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-24  8:27 [Qemu-devel] [PATCH] os-win32.c : fix memory leak Zhi Hui Li
2011-11-24  9:15 ` Mark
2011-11-24 10:27   ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
2011-11-24 19:28     ` Stefan Weil
2011-11-24 20:46       ` Stefan Weil
2011-11-25  8:56       ` Paolo Bonzini
2011-11-28 10:49 ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).