aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@linux.vnet.ibm.com>2010-04-21 20:35:45 +0100
committerAurelien Jarno <aurelien@aurel32.net>2010-04-24 12:45:03 +0200
commit012d4869c1eb195e83f159ed7b2bced33f37f960 (patch)
treecb5bfa9ccfce78f64780cd9d1d26df86b51f9c15 /block.c
parentlsi: fix segfault in lsi_command_complete (diff)
downloadqemu-kvm-012d4869c1eb195e83f159ed7b2bced33f37f960.tar.gz
qemu-kvm-012d4869c1eb195e83f159ed7b2bced33f37f960.tar.bz2
qemu-kvm-012d4869c1eb195e83f159ed7b2bced33f37f960.zip
block: Free iovec arrays allocated by multiwrite_merge()
A new iovec array is allocated when creating a merged write request. This patch ensures that the iovec array is deleted in addition to its qiov owner. Reported-by: Leszek Urbanski <tygrys@moo.pl> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> (cherry picked from commit 1e1ea48d42e011b9bdd0d689d184e7cac4617b66)
Diffstat (limited to 'block.c')
-rw-r--r--block.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/block.c b/block.c
index 4f9a48b71..7326bfeee 100644
--- a/block.c
+++ b/block.c
@@ -1608,6 +1608,9 @@ static void multiwrite_user_cb(MultiwriteCB *mcb)
for (i = 0; i < mcb->num_callbacks; i++) {
mcb->callbacks[i].cb(mcb->callbacks[i].opaque, mcb->error);
+ if (mcb->callbacks[i].free_qiov) {
+ qemu_iovec_destroy(mcb->callbacks[i].free_qiov);
+ }
qemu_free(mcb->callbacks[i].free_qiov);
qemu_vfree(mcb->callbacks[i].free_buf);
}