浏览代码

LibCore: Don't leak file descriptor inside AnonymousBuffer on Linux

Jean-Baptiste Boric 4 年之前
父节点
当前提交
c130161d9f
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      Userland/Libraries/LibCore/AnonymousBuffer.cpp

+ 1 - 0
Userland/Libraries/LibCore/AnonymousBuffer.cpp

@@ -64,6 +64,7 @@ AnonymousBuffer AnonymousBuffer::create_with_size(size_t size)
         return {};
         return {};
     }
     }
     if (ftruncate(fd, size) < 0) {
     if (ftruncate(fd, size) < 0) {
+        close(fd);
         perror("ftruncate");
         perror("ftruncate");
         return {};
         return {};
     }
     }