diff mbox

[PULL,1/4] bochs: Fix memory leak in bochs_open() error path

Message ID 1397219952-26807-2-git-send-email-kwolf@redhat.com
State New
Headers show

Commit Message

Kevin Wolf April 11, 2014, 12:39 p.m. UTC
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---
 block/bochs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/block/bochs.c b/block/bochs.c
index 826ec12..50b84a9 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) {