summary refs log tree commit diff stats
path: root/hw/vfio/display.c
diff options
context:
space:
mode:
authorZhenzhong Duan <zhenzhong.duan@intel.com>2024-07-01 09:48:08 +0800
committerCédric Le Goater <clg@redhat.com>2024-07-09 11:50:37 +0200
commitf15da599a1c5326e105425a74d2fb004a2a2649e (patch)
treeb2d719f813e0d0a44b7895b333a90c182a29c7bb /hw/vfio/display.c
parent956b30b9cf856470612e8d2c2c4985fb7e40a970 (diff)
downloadfocaccia-qemu-f15da599a1c5326e105425a74d2fb004a2a2649e.tar.gz
focaccia-qemu-f15da599a1c5326e105425a74d2fb004a2a2649e.zip
vfio/display: Fix potential memleak of edid info
EDID related device region info is leaked in vfio_display_edid_init()
error path and VFIODisplay destroying path.

Fixes: 08479114b0de ("vfio/display: add edid support.")
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Diffstat (limited to 'hw/vfio/display.c')
-rw-r--r--hw/vfio/display.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/vfio/display.c b/hw/vfio/display.c
index 661e921616..9c57fd3888 100644
--- a/hw/vfio/display.c
+++ b/hw/vfio/display.c
@@ -171,7 +171,9 @@ static void vfio_display_edid_init(VFIOPCIDevice *vdev)
 
 err:
     trace_vfio_display_edid_write_error();
+    g_free(dpy->edid_info);
     g_free(dpy->edid_regs);
+    dpy->edid_info = NULL;
     dpy->edid_regs = NULL;
     return;
 }
@@ -182,6 +184,7 @@ static void vfio_display_edid_exit(VFIODisplay *dpy)
         return;
     }
 
+    g_free(dpy->edid_info);
     g_free(dpy->edid_regs);
     g_free(dpy->edid_blob);
     timer_free(dpy->edid_link_timer);