aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorJason Baron <jbaron@redhat.com>2012-08-03 15:57:10 -0400
committerMichael Roth <mdroth@linux.vnet.ibm.com>2012-08-21 15:36:40 -0500
commitc094d3d8181f3193e402b49361327040c5725d79 (patch)
treee12a1bb469e051b5f466a038d94aa5f623da6e47 /hw
parenta47343957489b9fafdb438351e8fa9d58d7fd30b (diff)
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 <jbaron@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> (cherry picked from commit ea8d82a1ed72634f089ed1bccccd9c84cc1ab855) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/ide/ahci.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 2d7d03d772..1669a75a8d 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1041,6 +1041,9 @@ static int ahci_dma_rw_buf(IDEDMA *dma, int is_write)
dma_buf_write(p, l, &s->sg);
}
+ /* free sglist that was created in ahci_populate_sglist() */
+ qemu_sglist_destroy(&s->sg);
+
/* update number of transferred bytes */
ad->cur_cmd->status = cpu_to_le32(le32_to_cpu(ad->cur_cmd->status) + l);
s->io_buffer_index += l;