hw/i386/x86: free oem_id and oem_table_id on finalization
x86_machine_initfn allocates oem_id and oem_table_id via g_strndup,
but no instance_finalize existed for x86_machine_info, so these
strings were never freed when the object was destroyed.
Add x86_machine_finalize to release both fields.
Fixes: d07b22863b ("acpi: Move setters/getters of oem fields to X86MachineState")
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
@@ -372,6 +372,14 @@ static void x86_machine_initfn(Object *obj)
|
||||
x86ms->above_4g_mem_start = 4 * GiB;
|
||||
}
|
||||
|
||||
static void x86_machine_finalize(Object *obj)
|
||||
{
|
||||
X86MachineState *x86ms = X86_MACHINE(obj);
|
||||
|
||||
g_free(x86ms->oem_id);
|
||||
g_free(x86ms->oem_table_id);
|
||||
}
|
||||
|
||||
static void x86_machine_class_init(ObjectClass *oc, const void *data)
|
||||
{
|
||||
MachineClass *mc = MACHINE_CLASS(oc);
|
||||
@@ -445,6 +453,7 @@ static const TypeInfo x86_machine_info = {
|
||||
.abstract = true,
|
||||
.instance_size = sizeof(X86MachineState),
|
||||
.instance_init = x86_machine_initfn,
|
||||
.instance_finalize = x86_machine_finalize,
|
||||
.class_size = sizeof(X86MachineClass),
|
||||
.class_init = x86_machine_class_init,
|
||||
.interfaces = (const InterfaceInfo[]) {
|
||||
|
||||
Reference in New Issue
Block a user