@samitouri / QOSamiQemu / commits / 945fecae32

hw/s390x: Fix memory leaks after removing elements with QTAILQ_REMOVE

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> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> Tested-by: Matthew Rosato <mjrosato@linux.ibm.com> Message-ID: <20260511063825.53633-1-thuth@redhat.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>

Thomas Huth committed May 11, 2026 at 08:38 UTC 945fecae32e6db4016bc9464657359d9d32a4646
1 file changed +1
hw/s390x/s390-pci-vfio.c
+1
@@ -101,6 +101,7 @@ void s390_pci_end_dma_count(S390pciState *s, S390PCIDMACount *cnt)
101 cnt->users--;
102 if (cnt->users == 0) {
103 QTAILQ_REMOVE(&s->zpci_dma_limit, cnt, link);
104 + g_free(cnt);
105 }
106 }
107