From: GuoHan Zhao Date: Thu, 23 Oct 2025 06:31:06 +0000 (+0800) Subject: hw/uefi/ovmf-log: Fix memory leak in hmp_info_firmware_log X-Git-Tag: v10.2.0-rc1~47^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b6478122f059274b19805e14d12f76d2c0272ad4;p=thirdparty%2Fqemu.git hw/uefi/ovmf-log: Fix memory leak in hmp_info_firmware_log 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 --- 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;