Commit 99e1dec0 authored by Markus Armbruster's avatar Markus Armbruster Committed by Stefan Hajnoczi
Browse files

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: default avatarMarkus Armbruster <armbru@redhat.com>
Signed-off-by: default avatarStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
parent d3c481b3
......@@ -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));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment