Explorar el Código

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

Jean-Baptiste Boric hace 4 años
padre
commit
c130161d9f
Se han modificado 1 ficheros con 1 adiciones y 0 borrados
  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 {};
     }