Browse Source

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

Jean-Baptiste Boric 4 năm trước cách đây
mục cha
commit
c130161d9f
1 tập tin đã thay đổi với 1 bổ sung0 xóa
  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 {};
     }
     if (ftruncate(fd, size) < 0) {
+        close(fd);
         perror("ftruncate");
         return {};
     }