On 5/6/2026 10:41 AM, Thomas Huth wrote:
From: Thomas Huth <[email protected]>
The elements that get removed with QTAILQ_REMOVE are never referenced
afterwards anymore, so the corresponding memory should get freed.
Signed-off-by: Thomas Huth <[email protected]>
---
hw/s390x/s390-pci-bus.c | 1 +
hw/s390x/s390-pci-vfio.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index 4de7b587e8a..d45e08a69fd 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -911,6 +911,7 @@ static void s390_pcihost_unrealize(DeviceState *dev)
while (!QTAILQ_EMPTY(&s->zpci_groups)) {
group = QTAILQ_FIRST(&s->zpci_groups);
QTAILQ_REMOVE(&s->zpci_groups, group, link);
+ g_free(group);
}
}
diff --git a/hw/s390x/s390-pci-vfio.c b/hw/s390x/s390-pci-vfio.c
index 7c754b656da..db6de00bd28 100644
--- a/hw/s390x/s390-pci-vfio.c
+++ b/hw/s390x/s390-pci-vfio.c
@@ -101,6 +101,7 @@ void s390_pci_end_dma_count(S390pciState *s,
S390PCIDMACount *cnt)
cnt->users--;
if (cnt->users == 0) {
QTAILQ_REMOVE(&s->zpci_dma_limit, cnt, link);
+ g_free(cnt);
}
}
Reviewed-by: Farhan Ali<[email protected]>