Browse Source

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

Jean-Baptiste Boric 4 years ago
parent
commit
c130161d9f
1 changed files with 1 additions and 0 deletions
  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 {};
     }