]> git.proxmox.com Git - mirror_qemu.git/blobdiff - memory_mapping.c
virtio-pci: error out when both legacy and modern modes are disabled
[mirror_qemu.git] / memory_mapping.c
index 04db3ac7faf2caaec260959e7950400a993226d0..e3e0d951728040b3241ce966a9a9da7220d8112c 100644 (file)
@@ -12,7 +12,7 @@
  */
 
 #include "qemu/osdep.h"
-#include <glib.h>
+#include "qapi/error.h"
 
 #include "qemu-common.h"
 #include "cpu.h"
@@ -178,6 +178,7 @@ void guest_phys_blocks_free(GuestPhysBlockList *list)
 
     QTAILQ_FOREACH_SAFE(p, &list->head, next, q) {
         QTAILQ_REMOVE(&list->head, p, next);
+        memory_region_unref(p->mr);
         g_free(p);
     }
     list->num = 0;
@@ -241,6 +242,8 @@ static void guest_phys_blocks_region_add(MemoryListener *listener,
         block->target_start = target_start;
         block->target_end   = target_end;
         block->host_addr    = host_addr;
+        block->mr           = section->mr;
+        memory_region_ref(section->mr);
 
         QTAILQ_INSERT_TAIL(&g->list->head, block, next);
         ++g->list->num;