summaryrefslogtreecommitdiff
path: root/vmstate.c
diff options
context:
space:
mode:
authorChanho Park <chanho61.park@samsung.com>2014-12-10 15:42:55 +0900
committerChanho Park <chanho61.park@samsung.com>2014-12-10 15:42:55 +0900
commit0d6a2f7e595218b5632ba7005128470e65138951 (patch)
tree596b09930ef1538e6606450e2d8b88ec2e296a9b /vmstate.c
parent16b1353a36171ae06d63fd309f4772dbfb1da113 (diff)
downloadqemu-0d6a2f7e595218b5632ba7005128470e65138951.tar.gz
qemu-0d6a2f7e595218b5632ba7005128470e65138951.tar.bz2
qemu-0d6a2f7e595218b5632ba7005128470e65138951.zip
Imported Upstream version 2.2.0upstream/2.2.1upstream/2.2.0
Diffstat (limited to 'vmstate.c')
-rw-r--r--vmstate.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/vmstate.c b/vmstate.c
index ef2f87bda..3dde574c0 100644
--- a/vmstate.c
+++ b/vmstate.c
@@ -49,9 +49,16 @@ static void *vmstate_base_addr(void *opaque, VMStateField *field, bool alloc)
if (field->flags & VMS_POINTER) {
if (alloc && (field->flags & VMS_ALLOC)) {
- int n_elems = vmstate_n_elems(opaque, field);
- if (n_elems) {
- gsize size = n_elems * field->size;
+ gsize size = 0;
+ if (field->flags & VMS_VBUFFER) {
+ size = vmstate_size(opaque, field);
+ } else {
+ int n_elems = vmstate_n_elems(opaque, field);
+ if (n_elems) {
+ size = n_elems * field->size;
+ }
+ }
+ if (size) {
*((void **)base_addr + field->start) = g_malloc(size);
}
}