diff mbox

memory.c: bugfix - ref counting mismatch in memory_region_find

Message ID 1385994059-16812-1-git-send-email-marcel.a@redhat.com
State New
Headers show

Commit Message

Marcel Apfelbaum Dec. 2, 2013, 2:20 p.m. UTC
'address_space_get_flatview' gets a reference to a FlatView.
If the flatview lookup fails, the code returns without
"unreferencing" the view.

Cc: qemu-stable@nongnu.org

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
---
 memory.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Paolo Bonzini Dec. 2, 2013, 2:22 p.m. UTC | #1
Il 02/12/2013 15:20, Marcel Apfelbaum ha scritto:
> 'address_space_get_flatview' gets a reference to a FlatView.
> If the flatview lookup fails, the code returns without
> "unreferencing" the view.
> 
> Cc: qemu-stable@nongnu.org
> 
> Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
> ---
>  memory.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/memory.c b/memory.c
> index 28f6449..7764314 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -1596,6 +1596,7 @@ MemoryRegionSection memory_region_find(MemoryRegion *mr,
>      view = address_space_get_flatview(as);
>      fr = flatview_lookup(view, range);
>      if (!fr) {
> +        flatview_unref(view);
>          return ret;
>      }
>  
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
diff mbox

Patch

diff --git a/memory.c b/memory.c
index 28f6449..7764314 100644
--- a/memory.c
+++ b/memory.c
@@ -1596,6 +1596,7 @@  MemoryRegionSection memory_region_find(MemoryRegion *mr,
     view = address_space_get_flatview(as);
     fr = flatview_lookup(view, range);
     if (!fr) {
+        flatview_unref(view);
         return ret;
     }