diff mbox

[v2,1/7] memory: fix address space initialization/destruction

Message ID 1351597670-23031-2-git-send-email-avi@redhat.com
State New
Headers show

Commit Message

Avi Kivity Oct. 30, 2012, 11:47 a.m. UTC
A couple of fields were left uninitialized.  This was not observed earlier
because all address spaces were statically allocated.  Also free allocation
for those fields.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 memory.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox

Patch

diff --git a/memory.c b/memory.c
index 243cb23..ae3552b 100644
--- a/memory.c
+++ b/memory.c
@@ -1541,6 +1541,8 @@  void address_space_init(AddressSpace *as, MemoryRegion *root)
     as->root = root;
     as->current_map = g_new(FlatView, 1);
     flatview_init(as->current_map);
+    as->ioeventfd_nb = 0;
+    as->ioeventfds = NULL;
     QTAILQ_INSERT_TAIL(&address_spaces, as, address_spaces_link);
     as->name = NULL;
     memory_region_transaction_commit();
@@ -1557,6 +1559,7 @@  void address_space_destroy(AddressSpace *as)
     address_space_destroy_dispatch(as);
     flatview_destroy(as->current_map);
     g_free(as->current_map);
+    g_free(as->ioeventfds);
 }
 
 uint64_t io_mem_read(MemoryRegion *mr, hwaddr addr, unsigned size)