yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
9ae3a8
From 6b65120986e94f9f48ce92263b9660786038984b Mon Sep 17 00:00:00 2001
9ae3a8
Message-Id: <6b65120986e94f9f48ce92263b9660786038984b.1418766606.git.jen@redhat.com>
9ae3a8
In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com>
9ae3a8
References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com>
9ae3a8
From: Fam Zheng <famz@redhat.com>
9ae3a8
Date: Thu, 4 Dec 2014 00:05:22 -0600
9ae3a8
Subject: [CHANGE 28/31] vmdk: fix vmdk_parse_extents() extent_file leaks
9ae3a8
To: rhvirt-patches@redhat.com,
9ae3a8
    jen@redhat.com
9ae3a8
9ae3a8
RH-Author: Fam Zheng <famz@redhat.com>
9ae3a8
Message-id: <1417651524-18041-29-git-send-email-famz@redhat.com>
9ae3a8
Patchwork-id: 62701
9ae3a8
O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 28/30] vmdk: fix vmdk_parse_extents() extent_file leaks
9ae3a8
Bugzilla: 1002493
9ae3a8
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
9ae3a8
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
9ae3a8
RH-Acked-by: Max Reitz <mreitz@redhat.com>
9ae3a8
9ae3a8
From: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
9ae3a8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
Reviewed-by: Max Reitz <mreitz@redhat.com>
9ae3a8
Reviewed-by: Fam Zheng <famz@redhat.com>
9ae3a8
(cherry picked from commit ff74f33c310892c90c4439d963a6ce67f47ce18c)
9ae3a8
Signed-off-by: Fam Zheng <famz@redhat.com>
9ae3a8
Signed-off-by: Jeff E. Nelson <jen@redhat.com>
9ae3a8
---
9ae3a8
 block/vmdk.c | 2 ++
9ae3a8
 1 file changed, 2 insertions(+)
9ae3a8
9ae3a8
diff --git a/block/vmdk.c b/block/vmdk.c
9ae3a8
index b9ab89b..ddd06f0 100644
9ae3a8
--- a/block/vmdk.c
9ae3a8
+++ b/block/vmdk.c
9ae3a8
@@ -835,6 +835,7 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs,
9ae3a8
             ret = vmdk_add_extent(bs, extent_file, true, sectors,
9ae3a8
                             0, 0, 0, 0, 0, &extent, errp);
9ae3a8
             if (ret < 0) {
9ae3a8
+                bdrv_unref(extent_file);
9ae3a8
                 return ret;
9ae3a8
             }
9ae3a8
             extent->flat_start_offset = flat_offset << 9;
9ae3a8
@@ -854,6 +855,7 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs,
9ae3a8
             extent = &s->extents[s->num_extents - 1];
9ae3a8
         } else {
9ae3a8
             error_setg(errp, "Unsupported extent type '%s'", type);
9ae3a8
+            bdrv_unref(extent_file);
9ae3a8
             return -ENOTSUP;
9ae3a8
         }
9ae3a8
         extent->type = g_strdup(type);
9ae3a8
-- 
9ae3a8
2.1.0
9ae3a8