提交 99e1dec0 编写于 作者: M Markus Armbruster 提交者: Stefan Hajnoczi

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: NMarkus Armbruster <armbru@redhat.com>
Signed-off-by: NStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册