mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-23 05:29: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];
|
char Buffer[32];
|
||||||
int Length = read(FD, Buffer, sizeof(Buffer));
|
int Length = read(FD, Buffer, sizeof(Buffer));
|
||||||
if (Length < 0)
|
if (close(FD) != 0 || Length < 0)
|
||||||
return std::error_code(errno, std::generic_category());
|
return std::error_code(errno, std::generic_category());
|
||||||
|
|
||||||
Result = identify_magic(StringRef(Buffer, Length));
|
Result = identify_magic(StringRef(Buffer, Length));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user