block: Fix memory leaks in bdrv_co_do_pwritev()

The error path for a failure in one of the two bdrv_aligned_preadv()
calls leaked head_buf or tail_buf, respectively. This fixes the memory
leak.

Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
Kevin Wolf 2014-02-07 15:29:00 +01:00
parent ad6aef43d3
commit 99c4a85ce6

View file

@ -3279,9 +3279,9 @@ fail:
if (use_local_qiov) {
qemu_iovec_destroy(&local_qiov);
qemu_vfree(head_buf);
qemu_vfree(tail_buf);
}
qemu_vfree(head_buf);
qemu_vfree(tail_buf);
return ret;
}