Explorar o código

[LibOS] Fix handle leak in shim_do_munmap()

Rafał Wojdyła %!s(int64=5) %!d(string=hai) anos
pai
achega
4e12964dbd
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      LibOS/shim/src/sys/shim_mmap.c

+ 4 - 0
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)