diff options
| author | Zhenzhong Duan <zhenzhong.duan@intel.com> | 2024-05-22 12:40:12 +0800 |
|---|---|---|
| committer | Cédric Le Goater <clg@redhat.com> | 2024-05-22 10:04:22 +0200 |
| commit | 0d3e89bea8ff2fb74b829d80a8e3ebe05b80614a (patch) | |
| tree | 297033440f424cf363d1c29b28daa36fe7135d5e /hw/vfio/igd.c | |
| parent | 0a0bda0acd529161d5cbed6c603ab89674a9af8c (diff) | |
| download | focaccia-qemu-0d3e89bea8ff2fb74b829d80a8e3ebe05b80614a.tar.gz focaccia-qemu-0d3e89bea8ff2fb74b829d80a8e3ebe05b80614a.zip | |
vfio: Use g_autofree in all call site of vfio_get_region_info()
There are some exceptions when pointer to vfio_region_info is reused. In that case, the pointed memory is freed manually. Suggested-by: Cédric Le Goater <clg@redhat.com> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'hw/vfio/igd.c')
| -rw-r--r-- | hw/vfio/igd.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 402fc5ce1d..1e79202f2b 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -367,8 +367,8 @@ static const MemoryRegionOps vfio_igd_index_quirk = { void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr) { - struct vfio_region_info *rom = NULL, *opregion = NULL, - *host = NULL, *lpc = NULL; + g_autofree struct vfio_region_info *rom = NULL; + struct vfio_region_info *opregion = NULL, *host = NULL, *lpc = NULL; VFIOQuirk *quirk; VFIOIGDQuirk *igd; PCIDevice *lpc_bridge; @@ -609,7 +609,6 @@ void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr) trace_vfio_pci_igd_bdsm_enabled(vdev->vbasedev.name, ggms_mb + gms_mb); out: - g_free(rom); g_free(opregion); g_free(host); g_free(lpc); |