Skip to contentSkip to conversation

memory.c: bugfix - ref counting mismatch in memory_region_find

PATCH In review Marcel Apfelbaum 2 participants 2 messages Dec 2, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 memory.c: bugfix - ref counting mismatch in memory_region_find

'address_space_get_flatview' gets a reference to a FlatView. If the flatview lookup fails, the code returns without "unreferencing" the view.

---
 memory.c | 1 +
 1 file changed, 1 insertion(+)
memory.c +1 -0
index 28f6449..7764314 100644
@@ -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;
     }
 
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw

Il 02/12/2013 15:20, Marcel Apfelbaum ha scritto:

Quoted 17 lines

'address_space_get_flatview' gets a reference to a FlatView. If the flatview lookup fails, the code returns without "unreferencing" the view.

---
 memory.c | 1 +
 1 file changed, 1 insertion(+)
memory.c +0 -0
index 28f6449..7764314 100644

memory.c MemoryRegionSection memory_region_find(MemoryRegion *mr, · line 1602

Quoted 7 lines
memory.c +1 -0
@@ -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;
     }