aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2014-09-04 21:04:42 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2014-09-08 11:12:44 +0100
commitff74f33c310892c90c4439d963a6ce67f47ce18c (patch)
tree487aadfa91472f9c601768d0a4eb731588baba3f
parentc5fe97e359bf03db9a005433092f25d27d57398f (diff)
vmdk: fix vmdk_parse_extents() extent_file leaks
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com>
-rw-r--r--block/vmdk.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/block/vmdk.c b/block/vmdk.c
index 07cb62ceb7..9bf28f3390 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -834,6 +834,7 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs,
ret = vmdk_add_extent(bs, extent_file, true, sectors,
0, 0, 0, 0, 0, &extent, errp);
if (ret < 0) {
+ bdrv_unref(extent_file);
return ret;
}
extent->flat_start_offset = flat_offset << 9;
@@ -853,6 +854,7 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs,
extent = &s->extents[s->num_extents - 1];
} else {
error_setg(errp, "Unsupported extent type '%s'", type);
+ bdrv_unref(extent_file);
return -ENOTSUP;
}
extent->type = g_strdup(type);