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

This commit is contained in:
Jean-Baptiste Boric 2021-04-13 20:21:01 +02:00 committed by Andreas Kling
parent dcff87215b
commit c130161d9f
Notes: sideshowbarker 2024-07-18 20:25:00 +09:00

View File

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