From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
pbonzini@redhat.com, Fam Zheng <famz@redhat.com>,
peterx@redhat.com, qemu-block@nongnu.org
Subject: [Qemu-devel] [PATCH v2 2/3] vmdk: Switch to heap arrays for vmdk_read_cid
Date: Tue, 8 Mar 2016 16:24:35 +0800 [thread overview]
Message-ID: <1457425476-32547-3-git-send-email-famz@redhat.com> (raw)
In-Reply-To: <1457425476-32547-1-git-send-email-famz@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
---
block/vmdk.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index 1ec2452..c68f456 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -242,15 +242,17 @@ static void vmdk_free_last_extent(BlockDriverState *bs)
static uint32_t vmdk_read_cid(BlockDriverState *bs, int parent)
{
- char desc[DESC_SIZE];
+ char *desc;
uint32_t cid = 0xffffffff;
const char *p_name, *cid_str;
size_t cid_str_size;
BDRVVmdkState *s = bs->opaque;
int ret;
+ desc = g_malloc0(DESC_SIZE);
ret = bdrv_pread(bs->file->bs, s->desc_offset, desc, DESC_SIZE);
if (ret < 0) {
+ g_free(desc);
return 0;
}
@@ -269,6 +271,7 @@ static uint32_t vmdk_read_cid(BlockDriverState *bs, int parent)
sscanf(p_name, "%" SCNx32, &cid);
}
+ g_free(desc);
return cid;
}
--
2.4.3
next prev parent reply other threads:[~2016-03-08 8:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-08 8:24 [Qemu-devel] [PATCH v2 0/3] vmdk: Move descriptor buffers to heap Fam Zheng
2016-03-08 8:24 ` [Qemu-devel] [PATCH v2 1/3] vmdk: Switch to heap arrays for vmdk_write_cid Fam Zheng
2016-03-08 8:24 ` Fam Zheng [this message]
2016-03-08 8:24 ` [Qemu-devel] [PATCH v2 3/3] vmdk: Switch to heap arrays for vmdk_parent_open Fam Zheng
2016-03-09 0:43 ` Fam Zheng
2016-03-09 9:50 ` Kevin Wolf
2016-03-10 1:53 ` Fam Zheng
2016-03-08 12:36 ` [Qemu-devel] [PATCH v2 0/3] vmdk: Move descriptor buffers to heap Paolo Bonzini
2016-03-08 13:18 ` Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1457425476-32547-3-git-send-email-famz@redhat.com \
--to=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).