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: d07b22863b8e ("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>
Marc-André Lureau committed
Apr 27, 2026 at 14:47 UTC
46d619d018e830e5b659ee91e17dfc08d4e6ff59
1 file changed
+9
hw/i386/x86.c
+9
@@ -372,6 +372,14 @@ static void x86_machine_initfn(Object *obj)
372
x86ms->above_4g_mem_start = 4 * GiB;
373
}
374
375
+static void x86_machine_finalize(Object *obj)
376
+{
377
+ X86MachineState *x86ms = X86_MACHINE(obj);
378
+
379
+ g_free(x86ms->oem_id);
380
+ g_free(x86ms->oem_table_id);
381
+}
382
+
383
static void x86_machine_class_init(ObjectClass *oc, const void *data)
384
{
385
MachineClass *mc = MACHINE_CLASS(oc);
@@ -445,6 +453,7 @@ static const TypeInfo x86_machine_info = {
453
.abstract = true,
454
.instance_size = sizeof(X86MachineState),
455
.instance_init = x86_machine_initfn,
456
+ .instance_finalize = x86_machine_finalize,
457
.class_size = sizeof(X86MachineClass),
458
.class_init = x86_machine_class_init,
459
.interfaces = (const InterfaceInfo[]) {