Skip to content

Commit

Permalink
[XRay] [compiler-rt] Plug a file descriptor leak in a failure case.
Browse files Browse the repository at this point in the history
Summary: Fd needs to be closed before the number gets out of scope.

Reviewers: dberris

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31278

llvm-svn: 298685
  • Loading branch information
Martin Pelikan committed Mar 24, 2017
1 parent 1082904 commit 1730dc7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler-rt/lib/xray/xray_x86_64.cc
Expand Up @@ -44,9 +44,9 @@ static bool readValueFromFile(const char *Filename,
ssize_t BytesRead;
bool Success;
std::tie(BytesRead, Success) = retryingReadSome(Fd, Line, Line + BufSize);
close(Fd);
if (!Success)
return false;
close(Fd);
char *End = nullptr;
long long Tmp = internal_simple_strtoll(Line, &End, 10);
bool Result = false;
Expand Down

0 comments on commit 1730dc7

Please sign in to comment.