aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2011-11-08 15:36:49 +0100
committerStefan Hajnoczi <stefanha@linux.vnet.ibm.com>2011-11-10 12:29:50 +0000
commit99e1dec06f343cefecae9baeec0aae2f99f552d5 (patch)
tree1f6a53be3b7b9dc1d00e9ecc7aaa833dd5ef836b
parentd3c481b357ee6f78d3df10ee30407fa05d85b76c (diff)
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>
-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));