From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57445) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bi09f-0001CJ-Pu for qemu-devel@nongnu.org; Thu, 08 Sep 2016 10:18:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bi09e-0000bz-Mj for qemu-devel@nongnu.org; Thu, 08 Sep 2016 10:18:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30258) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bi09e-0000bs-Gw for qemu-devel@nongnu.org; Thu, 08 Sep 2016 10:18:14 -0400 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 8 Sep 2016 18:17:09 +0400 Message-Id: <20160908141720.30641-15-marcandre.lureau@redhat.com> In-Reply-To: <20160908141720.30641-1-marcandre.lureau@redhat.com> References: <20160908141720.30641-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULLv2 14/25] machine: use class base init generated name List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, eblake@redhat.com, armbru@redhat.com, pbonzini@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= machine_class_base_init() member name is allocated by machine_class_base_init(), but not freed by machine_class_finalize(). Simply freeing there doesn't work, because DEFINE_PC_MACHINE() overwrites it with a literal string. Fix DEFINE_PC_MACHINE() not to overwrite it, and add the missing free to machine_class_finalize(). Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Markus Armbruster --- hw/core/machine.c | 1 + include/hw/boards.h | 2 +- include/hw/i386/pc.h | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index e5a456f..00fbe3e 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -561,6 +561,7 @@ static void machine_class_finalize(ObjectClass *klass= , void *data) if (mc->compat_props) { g_array_free(mc->compat_props, true); } + g_free(mc->name); } =20 void machine_register_compat_props(MachineState *machine) diff --git a/include/hw/boards.h b/include/hw/boards.h index 3e69eca..e46a744 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -93,7 +93,7 @@ struct MachineClass { /*< public >*/ =20 const char *family; /* NULL iff @name identifies a standalone machty= pe */ - const char *name; + char *name; const char *alias; const char *desc; =20 diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 330c1f2..422fac7 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -903,7 +903,6 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64= _t *); { \ MachineClass *mc =3D MACHINE_CLASS(oc); \ optsfn(mc); \ - mc->name =3D namestr; \ mc->init =3D initfn; \ } \ static const TypeInfo pc_machine_type_##suffix =3D { \ --=20 2.10.0