diff mbox series

ramfb: avoid potential leak

Message ID 20230920082634.3349487-1-marcandre.lureau@redhat.com
State New
Headers show
Series ramfb: avoid potential leak | expand

Commit Message

Marc-André Lureau Sept. 20, 2023, 8:26 a.m. UTC
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 mbox series

Patch

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;
 }