OSDN Git Service

bochs: Fix memory leak in bochs_open() error path
authorKevin Wolf <kwolf@redhat.com>
Wed, 9 Apr 2014 09:19:04 +0000 (11:19 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 11 Apr 2014 11:59:49 +0000 (13:59 +0200)
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
block/bochs.c

index 826ec12..50b84a9 100644 (file)
@@ -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) {