[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 30/37] page_cache: fix memory leak
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 30/37] page_cache: fix memory leak |
Date: |
Tue, 2 Apr 2013 16:45:35 -0500 |
From: Peter Lieven <address@hidden>
XBZRLE encoded migration introduced a MRU page cache
meachnism. Unfortunately, cached items where never freed in
case of a collision in the page cache on cache_insert().
This lead to out of memory conditions during XBZRLE migration
if the page cache was small and there where a lot of collisions
in the cache.
Signed-off-by: Peter Lieven <address@hidden>
Signed-off-by: Orit Wasserman <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>
(cherry picked from commit 32a1c08b60a8ac0e63b54a5793a26b5e32b36618)
Signed-off-by: Michael Roth <address@hidden>
---
page_cache.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/page_cache.c b/page_cache.c
index 748957b..b92482c 100644
--- a/page_cache.c
+++ b/page_cache.c
@@ -152,6 +152,9 @@ void cache_insert(PageCache *cache, uint64_t addr, uint8_t
*pdata)
/* actual update of entry */
it = cache_get_by_addr(cache, addr);
+ /* free old cached data if any */
+ g_free(it->it_data);
+
if (!it->it_data) {
cache->num_items++;
}
--
1.7.9.5
- [Qemu-stable] [PATCH 35/37] linux-user: make bogus negative iovec lengths fail EINVAL, (continued)
- [Qemu-stable] [PATCH 35/37] linux-user: make bogus negative iovec lengths fail EINVAL, Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 34/37] linux-user: fix futex strace of FUTEX_CLOCK_REALTIME, Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 36/37] linux-user/syscall.c: Don't warn about unimplemented get_robust_list, Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 29/37] Fix page_cache leak in cache_resize, Michael Roth, 2013/04/02
- Re: [Qemu-stable] [Qemu-devel] Patch Round-up for stable 1.4.1, freeze next Tuesday, Eric Blake, 2013/04/02
- [Qemu-stable] [PATCH 31/37] qcow2: flush refcount cache correctly in alloc_refcount_block(), Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 37/37] update seabios to 1.7.2.1, Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 30/37] page_cache: fix memory leak,
Michael Roth <=
- [Qemu-stable] [PATCH 32/37] qcow2: flush refcount cache correctly in qcow2_write_snapshots(), Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 27/37] ide/macio: Fix macio DMA initialisation., Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 28/37] virtio-blk: fix unplug + virsh reboot, Michael Roth, 2013/04/02
- Re: [Qemu-stable] [Qemu-devel] Patch Round-up for stable 1.4.1, freeze next Tuesday, Aurelien Jarno, 2013/04/03
- Re: [Qemu-stable] Patch Round-up for stable 1.4.1, freeze next Tuesday, Bruce Rogers, 2013/04/03
- Re: [Qemu-stable] [Qemu-devel] Patch Round-up for stable 1.4.1, freeze next Tuesday, Cole Robinson, 2013/04/03
- Re: [Qemu-stable] [Qemu-devel] Patch Round-up for stable 1.4.1, freeze next Tuesday, Peter Lieven, 2013/04/04