]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hw/uefi/ovmf-log: Fix memory leak in hmp_info_firmware_log
authorGuoHan Zhao <zhaoguohan@kylinos.cn>
Thu, 23 Oct 2025 06:31:06 +0000 (14:31 +0800)
committerGerd Hoffmann <kraxel@redhat.com>
Thu, 23 Oct 2025 11:27:27 +0000 (13:27 +0200)
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 <zhaoguohan@kylinos.cn>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20251023063106.9834-1-zhaoguohan_salmon@163.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/uefi/ovmf-log.c

index 98ebb0209491ce72f2d3a8d80ae1b417c03adc9a..850ef21f88599f0544f897e13ebc9d851e904ae8 100644 (file)
@@ -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;