HVA remapped file backed RAMBlock shouldn't be freed with munmap() as it will create a hole in HVA area but file descriptor should be freed so it won't leak.
Rearrange code so that file descriptor is freed always if it's been used and drop unnecessary munmap() call/branch because qemu_anon_ram_free() is doing the same. Signed-off-by: Igor Mammedov <imamm...@redhat.com> --- exec.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/exec.c b/exec.c index 562dae5..08767ab 100644 --- a/exec.c +++ b/exec.c @@ -1612,14 +1612,14 @@ static void reclaim_ramblock(RAMBlock *block) ; } else if (xen_enabled()) { xen_invalidate_map_cache_entry(block->host); -#ifndef _WIN32 - } else if (block->fd >= 0) { - munmap(block->host, block->max_length); - close(block->fd); -#endif } else { qemu_anon_ram_free(block->host, block->max_length); } +#ifndef _WIN32 + if (block->fd >= 0) { + close(block->fd); + } +#endif g_free(block); } -- 1.8.3.1