From: Marc-André Lureau <marcandre.lur...@redhat.com> Remove machine class name initialization from DEFINE_PC_MACHINE, rely on class base init name generation instead. Get rid of some leaks that way.
Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> --- 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 2fe6ff6..07a7a97 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -558,6 +558,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); } 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 >*/ const char *family; /* NULL iff @name identifies a standalone machtype */ - const char *name; + char *name; const char *alias; const char *desc; diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index fad0873..54e0341 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -889,7 +889,6 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); { \ MachineClass *mc = MACHINE_CLASS(oc); \ optsfn(mc); \ - mc->name = namestr; \ mc->init = initfn; \ } \ static const TypeInfo pc_machine_type_##suffix = { \ -- 2.9.0