X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=qemu%2Fmemory_mapping.c;h=2354b2b7f32b5ef8fd13f35271a652f0adee59fa;hb=b345dcdf3a6a7ebf19d2932e009f16fc3f51c84e;hp=36d6b26046eef223125bcd2d76e6e360c96a8eb2;hpb=e44e3482bdb4d0ebde2d8b41830ac2cdb07948fb;p=kvmfornfv.git diff --git a/qemu/memory_mapping.c b/qemu/memory_mapping.c index 36d6b2604..2354b2b7f 100644 --- a/qemu/memory_mapping.c +++ b/qemu/memory_mapping.c @@ -11,6 +11,8 @@ * */ +#include "qemu/osdep.h" +#include "qapi/error.h" #include #include "qemu-common.h" @@ -177,6 +179,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; @@ -240,6 +243,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;