Skip to contentSkip to conversation

hw/core/machine: fix fdt memory leak

PATCH In review [email protected] 4 participants 4 messages Jul 9

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/core/machine: fix fdt memory leak

From: Marc-André Lureau <[email protected]>

The MachineState fdt field is allocated by various machine types via create_device_tree(), load_device_tree(), or similar, but was never freed in machine_finalize(). Add the missing g_free() call.

---
 hw/core/machine.c | 1 +
 1 file changed, 1 insertion(+)
hw/core/machine.c +1 -0
index 15886a56b19..f3073294d63 100644
@@ -1306,6 +1306,7 @@ static void machine_finalize(Object *obj)
     g_free(ms->nvdimms_state);
     g_free(ms->numa_state);
     g_free(ms->audiodev);
+    g_free(ms->fdt);
 }
 
 bool machine_usb(MachineState *machine)
Signature · 1 line
2.55.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · On Thu, 9 Jul 2026 at 12:13, <[email protected]> wrote:

From: Marc-André Lureau <[email protected]>

The MachineState fdt field is allocated by various machine types via create_device_tree(), load_device_tree(), or similar, but was never freed in machine_finalize(). Add the missing g_free() call.

---
 hw/core/machine.c | 1 +

thanks
-- PMM

Reviewed-by on v1 1/1
#2 lore raw
In reply to [email protected]
Quoted 10 lines · On 9/7/26 13:12, [email protected] wrote:

From: Marc-André Lureau <[email protected]>

The MachineState fdt field is allocated by various machine types via create_device_tree(), load_device_tree(), or similar, but was never freed in machine_finalize(). Add the missing g_free() call.

---
  hw/core/machine.c | 1 +
  1 file changed, 1 insertion(+)
Reviewed-by on v1 1/1
#3 lore raw
In reply to [email protected]
Quoted 6 lines · On Thu, Jul 09, 2026 at 03:12:49PM +0400, [email protected] wrote:

Date: Thu, 9 Jul 2026 15:12:49 +0400
From: [email protected]
Subject: [PATCH] hw/core/machine: fix fdt memory leak

From: Marc-André Lureau <[email protected]>

Quoted 8 lines

The MachineState fdt field is allocated by various machine types via create_device_tree(), load_device_tree(), or similar, but was never freed in machine_finalize(). Add the missing g_free() call.

---
 hw/core/machine.c | 1 +
 1 file changed, 1 insertion(+)