Patchwork [29/37] Fix page_cache leak in cache_resize

login
register
mail settings
Submitter Michael Roth
Date April 2, 2013, 9:45 p.m.
Message ID <1364939142-30066-30-git-send-email-mdroth@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/233192/
State New
Headers show

Comments

Michael Roth - April 2, 2013, 9:45 p.m.
From: Orit Wasserman <owasserm@redhat.com>

Signed-off-by: Orit Wasserman <owasserm@redhat.com>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Juan Quintela <quintela@redhat.com>
(cherry picked from commit 0db65d624e0211a43c011579d6607a50d8f06082)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 page_cache.c |    1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/page_cache.c b/page_cache.c
index ba5640b..748957b 100644
--- a/page_cache.c
+++ b/page_cache.c
@@ -208,6 +208,7 @@  int64_t cache_resize(PageCache *cache, int64_t new_num_pages)
         }
     }
 
+    g_free(cache->page_cache);
     cache->page_cache = new_cache->page_cache;
     cache->max_num_items = new_cache->max_num_items;
     cache->num_items = new_cache->num_items;