mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
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>
This commit is contained in:
parent
d3c481b357
commit
99e1dec06f
1 changed files with 1 additions and 0 deletions
|
@ -950,6 +950,7 @@ static int cpudef_setfield(const char *name, const char *str, void *opaque)
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if (!strcmp(name, "name")) {
|
if (!strcmp(name, "name")) {
|
||||||
|
g_free((void *)def->name);
|
||||||
def->name = g_strdup(str);
|
def->name = g_strdup(str);
|
||||||
} else if (!strcmp(name, "model_id")) {
|
} else if (!strcmp(name, "model_id")) {
|
||||||
strncpy(def->model_id, str, sizeof (def->model_id));
|
strncpy(def->model_id, str, sizeof (def->model_id));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue