From: Kevin Wolf Date: Fri, 7 Feb 2014 14:29:00 +0000 (+0100) Subject: block: Fix memory leaks in bdrv_co_do_pwritev() X-Git-Tag: v2.0.0-rc0~93^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=99c4a85ce65863e6ba6668164d47c0d7c645e3aa;p=thirdparty%2Fqemu.git 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 Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Laszlo Ersek --- diff --git a/block.c b/block.c index ac0ccac76df..c1d1f74b88c 100644 --- a/block.c +++ b/block.c @@ -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; }