Skip to content

Commit 92cb9b2

Browse files
author
codefaber
committed
[libc] Fix memory leak in linux/file.cpp
1 parent 82e4b83 commit 92cb9b2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

libc/src/__support/File/linux/file.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ ErrorOr<LinuxFile *> create_file_from_fd(int fd, const char *mode) {
165165
auto *file = new (ac)
166166
LinuxFile(fd, buffer, File::DEFAULT_BUFFER_SIZE, _IOFBF, true, modeflags);
167167
if (!ac) {
168+
free(buffer);
168169
return Error(ENOMEM);
169170
}
170171
if (do_seek) {

0 commit comments

Comments
 (0)