aboutsummaryrefslogtreecommitdiff
path: root/page_cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'page_cache.c')
-rw-r--r--page_cache.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/page_cache.c b/page_cache.c
index e5717d53c9..809dadc7eb 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++;
}