From ea8d82a1ed72634f089ed1bccccd9c84cc1ab855 Mon Sep 17 00:00:00 2001 From: Jason Baron Date: Fri, 3 Aug 2012 15:57:10 -0400 Subject: ahci: Fix sglist memleak in ahci_dma_rw_buf() I noticed that in hw/ide/ahci:ahci_dma_rw_buf() we do not free the sglist. Thus, I've added a call to qemu_sglist_destroy() to fix this memory leak. In addition, I've adeed a call in qemu_sglist_destroy() to 0 all of the sglist fields, in case there is some other codepath that tries to free the sglist. Signed-off-by: Jason Baron Signed-off-by: Kevin Wolf --- dma-helpers.c | 1 + 1 file changed, 1 insertion(+) (limited to 'dma-helpers.c') diff --git a/dma-helpers.c b/dma-helpers.c index 35cb500581..13593d1b42 100644 --- a/dma-helpers.c +++ b/dma-helpers.c @@ -65,6 +65,7 @@ void qemu_sglist_add(QEMUSGList *qsg, dma_addr_t base, dma_addr_t len) void qemu_sglist_destroy(QEMUSGList *qsg) { g_free(qsg->sg); + memset(qsg, 0, sizeof(*qsg)); } typedef struct { -- cgit v1.2.1