summaryrefslogtreecommitdiffstats
path: root/target-i386
diff options
context:
space:
mode:
authorMarkus Armbruster2011-11-08 15:36:49 +0100
committerStefan Hajnoczi2011-11-10 13:29:50 +0100
commit99e1dec06f343cefecae9baeec0aae2f99f552d5 (patch)
tree1f6a53be3b7b9dc1d00e9ecc7aaa833dd5ef836b /target-i386
parentx86/cpuid: Convert remaining strdup() to g_strdup() (diff)
downloadqemu-99e1dec06f343cefecae9baeec0aae2f99f552d5.tar.gz
qemu-99e1dec06f343cefecae9baeec0aae2f99f552d5.tar.xz
qemu-99e1dec06f343cefecae9baeec0aae2f99f552d5.zip
x86/cpuid: Plug memory leak in cpudef_setfield()
To reproduce the leak, put two name options into the same [cpudef] section of target-x86_64.conf. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Diffstat (limited to 'target-i386')
-rw-r--r--target-i386/cpuid.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
index 352c390d0c..99cff65aae 100644
--- a/target-i386/cpuid.c
+++ b/target-i386/cpuid.c
@@ -950,6 +950,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));