From 56d77f768a5aa2b35ba645ae05d56e9908457c92 Mon Sep 17 00:00:00 2001 Message-Id: <56d77f768a5aa2b35ba645ae05d56e9908457c92.1418766606.git.jen@redhat.com> In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> From: Fam Zheng Date: Thu, 4 Dec 2014 00:05:23 -0600 Subject: [CHANGE 29/31] vmdk: fix buf leak in vmdk_parse_extents() To: rhvirt-patches@redhat.com, jen@redhat.com RH-Author: Fam Zheng Message-id: <1417651524-18041-30-git-send-email-famz@redhat.com> Patchwork-id: 62702 O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 29/30] vmdk: fix buf leak in vmdk_parse_extents() Bugzilla: 1002493 RH-Acked-by: Jeffrey Cody RH-Acked-by: Markus Armbruster RH-Acked-by: Max Reitz From: Stefan Hajnoczi vmdk_open_sparse() does not take ownership of buf so the caller always needs to free it. Signed-off-by: Stefan Hajnoczi Reviewed-by: Max Reitz Reviewed-by: Fam Zheng (cherry picked from commit b6b1d31f098eef8cd13556d343e46c213fac972a) Signed-off-by: Fam Zheng Signed-off-by: Jeff E. Nelson --- block/vmdk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/vmdk.c b/block/vmdk.c index ddd06f0..0593a1a 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -847,8 +847,8 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, } else { ret = vmdk_open_sparse(bs, extent_file, bs->open_flags, buf, errp); } + g_free(buf); if (ret) { - g_free(buf); bdrv_unref(extent_file); return ret; } -- 2.1.0