mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
Don't leak a file descriptor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211699 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3c26b95512
commit
95be6a7c3d
@ -1065,7 +1065,7 @@ std::error_code identify_magic(const Twine &Path, file_magic &Result) {
|
||||
|
||||
char Buffer[32];
|
||||
int Length = read(FD, Buffer, sizeof(Buffer));
|
||||
if (Length < 0)
|
||||
if (close(FD) != 0 || Length < 0)
|
||||
return std::error_code(errno, std::generic_category());
|
||||
|
||||
Result = identify_magic(StringRef(Buffer, Length));
|
||||
|
Loading…
Reference in New Issue
Block a user