[PATCH] D31278: [XRay] [compiler-rt] Plug a file descriptor leak in a failure case.

Martin Pelikán via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 23 22:15:16 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL298685: [XRay] [compiler-rt] Plug a file descriptor leak in a failure case. (authored by pelikan).

Changed prior to commit:
  https://reviews.llvm.org/D31278?vs=92763&id=92897#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31278

Files:
  compiler-rt/trunk/lib/xray/xray_x86_64.cc


Index: compiler-rt/trunk/lib/xray/xray_x86_64.cc
===================================================================
--- compiler-rt/trunk/lib/xray/xray_x86_64.cc
+++ compiler-rt/trunk/lib/xray/xray_x86_64.cc
@@ -44,9 +44,9 @@
   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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31278.92897.patch
Type: text/x-patch
Size: 516 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170324/08cf1fb8/attachment.bin>


More information about the llvm-commits mailing list