Message ID | 1436348808-223033-6-git-send-email-imammedo@redhat.com |
---|---|
State | New |
Headers | show |
diff --git a/exec.c b/exec.c index 41d14fc..ebbcfe9 100644 --- a/exec.c +++ b/exec.c @@ -1608,14 +1608,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); }
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 <imammedo@redhat.com> --- exec.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)