aboutsummaryrefslogtreecommitdiff
path: root/block/vmdk.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2014-09-04 21:04:43 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2014-09-08 11:12:44 +0100
commitb6b1d31f098eef8cd13556d343e46c213fac972a (patch)
treed26f301c75bdc8d5651492a912f1a63c7e16b056 /block/vmdk.c
parentff74f33c310892c90c4439d963a6ce67f47ce18c (diff)
downloadqemu-b6b1d31f098eef8cd13556d343e46c213fac972a.zip
qemu-b6b1d31f098eef8cd13556d343e46c213fac972a.tar.gz
qemu-b6b1d31f098eef8cd13556d343e46c213fac972a.tar.bz2
vmdk: fix buf leak in vmdk_parse_extents()
vmdk_open_sparse() does not take ownership of buf so the caller always needs to free it. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com>
Diffstat (limited to 'block/vmdk.c')
-rw-r--r--block/vmdk.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/vmdk.c b/block/vmdk.c
index 9bf28f3..a1cb911 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -846,8 +846,8 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs,
} else {
ret = vmdk_open_sparse(bs, extent_file, bs->open_flags, buf, errp);
}
+ g_free(buf);
if (ret) {
- g_free(buf);
bdrv_unref(extent_file);
return ret;
}