OSDN Git Service

hw/virtio: Free VirtIOIOMMUPCI::vdev.reserved_regions[] on finalize()
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 21 Nov 2023 17:40:47 +0000 (18:40 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 27 Nov 2023 15:27:41 +0000 (15:27 +0000)
commitc9a4aa06dfce0fde1e279e1ea0c1945582ec0d16
tree4ea6dbbf0af4d232b57cad4179839f433cf2cdee
parent837053a7f491b445088eac647abe7f462c50f59a
hw/virtio: Free VirtIOIOMMUPCI::vdev.reserved_regions[] on finalize()

Commit 0be6bfac62 ("qdev: Implement variable length array properties")
added the DEFINE_PROP_ARRAY() macro with the following comment:

  * It is the responsibility of the device deinit code to free the
  * @_arrayfield memory.

Commit 8077b8e549 added:

  DEFINE_PROP_ARRAY("reserved-regions", VirtIOIOMMUPCI,
                    vdev.nb_reserved_regions, vdev.reserved_regions,
                    qdev_prop_reserved_region, ReservedRegion),

but forgot to free the 'vdev.reserved_regions' array. Do it in the
instance_finalize() handler.

Cc: qemu-stable@nongnu.org
Fixes: 8077b8e549 ("virtio-iommu-pci: Add array of Interval properties") # v5.1.0+
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Message-id: 20231121174051.63038-3-philmd@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/virtio/virtio-iommu-pci.c