qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] ramfb: avoid potential leak


From: marcandre . lureau
Subject: [PATCH] ramfb: avoid potential leak
Date: Wed, 20 Sep 2023 12:26:34 +0400

From: Marc-André Lureau <marcandre.lureau@redhat.com>

If the fwcfg is written several times (without surface being displayed
in the meantime), we may leak surfaces.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/display/ramfb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/display/ramfb.c b/hw/display/ramfb.c
index 4cd90a9382..116d674348 100644
--- a/hw/display/ramfb.c
+++ b/hw/display/ramfb.c
@@ -100,6 +100,7 @@ static void ramfb_fw_cfg_write(void *dev, off_t offset, 
size_t len)
 
     s->width = width;
     s->height = height;
+    g_clear_pointer(&s->ds, qemu_free_displaysurface);
     s->ds = surface;
 }
 
-- 
2.41.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]