Skip to content

Commit

Permalink
bochs: Fix memory leak in bochs_open() error path
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
  • Loading branch information
kevmw committed Apr 11, 2014
1 parent f516a5c commit 28ec11b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions block/bochs.c
Expand Up @@ -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) {
Expand Down

0 comments on commit 28ec11b

Please sign in to comment.