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>
This commit is contained in:
Thomas Huth
2026-05-11 08:38:25 +02:00
committed by Cornelia Huck
parent 29c042c6e9
commit 945fecae32

View File

@@ -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);
}
}