From 4e12964dbd58c1e7e264a5646f74d17d445ddafc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Wojdy=C5=82a?= Date: Tue, 9 Apr 2019 13:39:24 +0200 Subject: [PATCH] [LibOS] Fix handle leak in shim_do_munmap() --- LibOS/shim/src/sys/shim_mmap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/LibOS/shim/src/sys/shim_mmap.c b/LibOS/shim/src/sys/shim_mmap.c index 3cbeb8e7..a2472c02 100644 --- a/LibOS/shim/src/sys/shim_mmap.c +++ b/LibOS/shim/src/sys/shim_mmap.c @@ -182,6 +182,10 @@ int shim_do_munmap (void * addr, size_t length) return -EFAULT; } + /* lookup_overlap_vma() calls __dump_vma() which adds a reference to file */ + if (vma.file) + put_handle(vma.file); + /* Protect first to make sure no overlapping with internal * mappings */ if (bkeep_mprotect(addr, length, PROT_NONE, 0) < 0)