From: Markus Armbruster Date: Tue, 8 Nov 2011 14:36:49 +0000 (+0100) Subject: x86/cpuid: Plug memory leak in cpudef_setfield() X-Git-Tag: v1.0-rc2~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=99e1dec06f343cefecae9baeec0aae2f99f552d5;p=thirdparty%2Fqemu.git 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 Signed-off-by: Stefan Hajnoczi --- diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c index 352c390d0c6..99cff65aae4 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));