From 46d619d018e830e5b659ee91e17dfc08d4e6ff59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 27 Apr 2026 14:47:27 +0400 Subject: [PATCH] hw/i386/x86: free oem_id and oem_table_id on finalization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: d07b22863b8e ("acpi: Move setters/getters of oem fields to X86MachineState") Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Marc-André Lureau --- hw/i386/x86.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 01872cba07..dc7f0d56b0 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -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[]) {