All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-trivial] [PATCH] os-win32.c : fix memory leak
@ 2011-11-24  8:27 ` Zhi Hui Li
  0 siblings, 0 replies; 14+ 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] 14+ messages in thread

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

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.