:p
atchew
Login
From: Thomas Huth <thuth@redhat.com> 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 <thuth@redhat.com> --- 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 XXXXXXX..XXXXXXX 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -XXX,XX +XXX,XX @@ 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 XXXXXXX..XXXXXXX 100644 --- a/hw/s390x/s390-pci-vfio.c +++ b/hw/s390x/s390-pci-vfio.c @@ -XXX,XX +XXX,XX @@ 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); } } -- 2.54.0
From: Thomas Huth <thuth@redhat.com> The elements that get removed with QTAILQ_REMOVE are never referenced afterwards anymore, so the corresponding memory should get freed. Fixes: 37fa32de70 ("s390x/pci: Honor DMA limits set by vfio") Reviewed-by: Farhan Ali <alifm@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com> --- v2: Drop change to hw/s390x/s390-pci-bus.c (since it needs other rework) hw/s390x/s390-pci-vfio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/s390x/s390-pci-vfio.c b/hw/s390x/s390-pci-vfio.c index XXXXXXX..XXXXXXX 100644 --- a/hw/s390x/s390-pci-vfio.c +++ b/hw/s390x/s390-pci-vfio.c @@ -XXX,XX +XXX,XX @@ 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); } } -- 2.54.0