summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCore/AnonymousBuffer.cpp
diff options
context:
space:
mode:
authorJean-Baptiste Boric <jblbeurope@gmail.com>2021-04-13 20:21:01 +0200
committerAndreas Kling <kling@serenityos.org>2021-04-13 21:52:34 +0200
commitc130161d9f455d3b3900d09dc6296e1604b2df7c (patch)
tree6d80d130dda796d9e0aa79d61a1e8a826184e6ee /Userland/Libraries/LibCore/AnonymousBuffer.cpp
parentdcff87215b283fd6de300026724972075085bd8e (diff)
downloadserenity-c130161d9f455d3b3900d09dc6296e1604b2df7c.zip
LibCore: Don't leak file descriptor inside AnonymousBuffer on Linux
Diffstat (limited to 'Userland/Libraries/LibCore/AnonymousBuffer.cpp')
-rw-r--r--Userland/Libraries/LibCore/AnonymousBuffer.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCore/AnonymousBuffer.cpp b/Userland/Libraries/LibCore/AnonymousBuffer.cpp
index e30d229c7c..ef55f8bfdb 100644
--- a/Userland/Libraries/LibCore/AnonymousBuffer.cpp
+++ b/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 {};
}