From b6478122f059274b19805e14d12f76d2c0272ad4 Mon Sep 17 00:00:00 2001 From: GuoHan Zhao Date: Thu, 23 Oct 2025 14:31:06 +0800 Subject: [PATCH] hw/uefi/ovmf-log: Fix memory leak in hmp_info_firmware_log MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The FirmwareLog object returned by qmp_query_firmware_log() was not being freed, causing a memory leak. Use g_autoptr to ensure the object is automatically freed when it goes out of scope. Fixes: c8aa8120313f ("hw/uefi: add 'info firmware-log' hmp monitor command.") Signed-off-by: GuoHan Zhao Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20251023063106.9834-1-zhaoguohan_salmon@163.com> Signed-off-by: Gerd Hoffmann --- hw/uefi/ovmf-log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/uefi/ovmf-log.c b/hw/uefi/ovmf-log.c index 98ebb02094..850ef21f88 100644 --- a/hw/uefi/ovmf-log.c +++ b/hw/uefi/ovmf-log.c @@ -261,7 +261,7 @@ void hmp_info_firmware_log(Monitor *mon, const QDict *qdict) g_autofree gchar *log_esc = NULL; g_autofree guchar *log_out = NULL; Error *err = NULL; - FirmwareLog *log; + g_autoptr(FirmwareLog) log = NULL; gsize log_len; int64_t maxsize; -- 2.47.3