From: Kevin Wolf Date: Wed, 9 Apr 2014 09:19:04 +0000 (+0200) Subject: bochs: Fix memory leak in bochs_open() error path X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~386^2~42^2~12^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=28ec11bc882387e51c7450558af5a49b8be95a36;p=sdk%2Femulator%2Fqemu.git bochs: Fix memory leak in bochs_open() error path Signed-off-by: Kevin Wolf Reviewed-by: Laszlo Ersek --- 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) {