mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
vfio/pci: Use g_autofree for vfio_region_info pointer
Pointer opregion is freed after vfio_pci_igd_opregion_init(). Use 'g_autofree' to avoid the g_free() calls. 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>
This commit is contained in:
parent
b771a40f9e
commit
514855e18f
1 changed files with 1 additions and 2 deletions
|
@ -3143,7 +3143,7 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
|
||||||
|
|
||||||
if (!vdev->igd_opregion &&
|
if (!vdev->igd_opregion &&
|
||||||
vdev->features & VFIO_FEATURE_ENABLE_IGD_OPREGION) {
|
vdev->features & VFIO_FEATURE_ENABLE_IGD_OPREGION) {
|
||||||
struct vfio_region_info *opregion;
|
g_autofree struct vfio_region_info *opregion = NULL;
|
||||||
|
|
||||||
if (vdev->pdev.qdev.hotplugged) {
|
if (vdev->pdev.qdev.hotplugged) {
|
||||||
error_setg(errp,
|
error_setg(errp,
|
||||||
|
@ -3162,7 +3162,6 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = vfio_pci_igd_opregion_init(vdev, opregion, errp);
|
ret = vfio_pci_igd_opregion_init(vdev, opregion, errp);
|
||||||
g_free(opregion);
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
goto out_teardown;
|
goto out_teardown;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue