]> git.proxmox.com Git - qemu.git/blobdiff - exec.c
memory: add ref/unref calls
[qemu.git] / exec.c
diff --git a/exec.c b/exec.c
index f926bd793fed1c6398a489f9ddead81c1b9bd0b8..e3ac1a18fdc8a2899d180fe621eddf4ff915d645 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -763,11 +763,14 @@ static uint16_t phys_section_add(MemoryRegionSection *section)
                                 phys_sections_nb_alloc);
     }
     phys_sections[phys_sections_nb] = *section;
+    memory_region_ref(section->mr);
     return phys_sections_nb++;
 }
 
 static void phys_section_destroy(MemoryRegion *mr)
 {
+    memory_region_unref(mr);
+
     if (mr->subpage) {
         subpage_t *subpage = container_of(mr, subpage_t, iomem);
         memory_region_destroy(&subpage->iomem);