qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Gerd Hoffmann" <kraxel@redhat.com>,
	"GuoHan Zhao" <zhaoguohan@kylinos.cn>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PULL 1/1] hw/uefi/ovmf-log: Fix memory leak in hmp_info_firmware_log
Date: Thu, 23 Oct 2025 15:28:25 +0200	[thread overview]
Message-ID: <20251023132825.338615-2-kraxel@redhat.com> (raw)
In-Reply-To: <20251023132825.338615-1-kraxel@redhat.com>

From: GuoHan Zhao <zhaoguohan@kylinos.cn>

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/uefi/ovmf-log.c b/hw/uefi/ovmf-log.c
index 98ebb0209491..850ef21f8859 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.51.0



  reply	other threads:[~2025-10-23 13:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-23 13:28 [PULL 0/1] Uefi 20251023 patches Gerd Hoffmann
2025-10-23 13:28 ` Gerd Hoffmann [this message]
2025-10-23 19:33 ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251023132825.338615-2-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=zhaoguohan@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).