summaryrefslogtreecommitdiff
path: root/block/bochs.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2014-04-09 11:19:04 +0200
committerKevin Wolf <kwolf@redhat.com>2014-04-11 13:59:49 +0200
commit28ec11bc882387e51c7450558af5a49b8be95a36 (patch)
treee86b68885e9581f17671d8a8d2b397dcecf941bd /block/bochs.c
parentf516a5cc051db6e999e9e60dc968dcb5aeffe11f (diff)
downloadqemu-28ec11bc882387e51c7450558af5a49b8be95a36.tar.gz
bochs: Fix memory leak in bochs_open() error path
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'block/bochs.c')
-rw-r--r--block/bochs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/block/bochs.c b/block/bochs.c
index 826ec1203c..50b84a91f3 100644
--- a/block/bochs.c
+++ b/block/bochs.c
@@ -150,11 +150,13 @@ static int bochs_open(BlockDriverState *bs, QDict *options, int flags,
s->extent_size = le32_to_cpu(bochs.extent);
if (s->extent_size == 0) {
error_setg(errp, "Extent size may not be zero");
- return -EINVAL;
+ ret = -EINVAL;
+ goto fail;
} else if (s->extent_size > 0x800000) {
error_setg(errp, "Extent size %" PRIu32 " is too large",
s->extent_size);
- return -EINVAL;
+ ret = -EINVAL;
+ goto fail;
}
if (s->catalog_size < bs->total_sectors / s->extent_size) {