diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2013-05-06 10:46:11 +0200 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2013-07-04 17:42:45 +0200 |
| commit | dfde4e6e1a868f60033ece0590b1f75e6c57fa16 (patch) | |
| tree | a84c1cddd96c6dc60fd7a5d35949b4fcaf9a32ed /hw/display/framebuffer.c | |
| parent | 3ce10901ca8da9142dcdcde198fda1a4c290934c (diff) | |
| download | focaccia-qemu-dfde4e6e1a868f60033ece0590b1f75e6c57fa16.tar.gz focaccia-qemu-dfde4e6e1a868f60033ece0590b1f75e6c57fa16.zip | |
memory: add ref/unref calls
Add ref/unref calls at the following places: - places where memory regions are stashed by a listener and used outside the BQL (including in Xen or KVM). - memory_region_find callsites - creation of aliases and containers (only the aliased/contained region gets a reference to avoid loops) - around calls to del_subregion/add_subregion, where the region could disappear after the first call Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/display/framebuffer.c')
| -rw-r--r-- | hw/display/framebuffer.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/hw/display/framebuffer.c b/hw/display/framebuffer.c index 49c9e59043..4546e42654 100644 --- a/hw/display/framebuffer.c +++ b/hw/display/framebuffer.c @@ -54,11 +54,11 @@ void framebuffer_update_display( src_len = src_width * rows; mem_section = memory_region_find(address_space, base, src_len); + mem = mem_section.mr; if (int128_get64(mem_section.size) != src_len || !memory_region_is_ram(mem_section.mr)) { - return; + goto out; } - mem = mem_section.mr; assert(mem); assert(mem_section.offset_within_address_space == base); @@ -68,10 +68,10 @@ void framebuffer_update_display( but it's not really worth it as dirty flag tracking will probably already have failed above. */ if (!src_base) - return; + goto out; if (src_len != src_width * rows) { cpu_physical_memory_unmap(src_base, src_len, 0, 0); - return; + goto out; } src = src_base; dest = surface_data(ds); @@ -102,10 +102,12 @@ void framebuffer_update_display( } cpu_physical_memory_unmap(src_base, src_len, 0, 0); if (first < 0) { - return; + goto out; } memory_region_reset_dirty(mem, mem_section.offset_within_region, src_len, DIRTY_MEMORY_VGA); *first_row = first; *last_row = last; +out: + memory_region_unref(mem); } |