[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-trivial] [PATCH 2/3] x86/cpuid: Plug memory leak in cpudef_setfiel
From: |
Markus Armbruster |
Subject: |
[Qemu-trivial] [PATCH 2/3] x86/cpuid: Plug memory leak in cpudef_setfield() |
Date: |
Tue, 8 Nov 2011 15:36:49 +0100 |
To reproduce the leak, put two name options into the same [cpudef]
section of target-x86_64.conf.
Signed-off-by: Markus Armbruster <address@hidden>
---
target-i386/cpuid.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
index 7c8f1be..0fce752 100644
--- a/target-i386/cpuid.c
+++ b/target-i386/cpuid.c
@@ -969,6 +969,7 @@ static int cpudef_setfield(const char *name, const char
*str, void *opaque)
int err = 0;
if (!strcmp(name, "name")) {
+ g_free((void *)def->name);
def->name = g_strdup(str);
} else if (!strcmp(name, "model_id")) {
strncpy(def->model_id, str, sizeof (def->model_id));
--
1.7.6.4