[Lldb-commits] [lldb] r182537 - Fixed a file leak introduced with my last checkin. Also be sure to include <stdio.h> just in case.

Greg Clayton gclayton at apple.com
Wed May 22 16:29:16 PDT 2013


Author: gclayton
Date: Wed May 22 18:29:16 2013
New Revision: 182537

URL: http://llvm.org/viewvc/llvm-project?rev=182537&view=rev
Log:
Fixed a file leak introduced with my last checkin. Also be sure to include <stdio.h> just in case.


Modified:
    lldb/trunk/source/Interpreter/PythonDataObjects.cpp

Modified: lldb/trunk/source/Interpreter/PythonDataObjects.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/PythonDataObjects.cpp?rev=182537&r1=182536&r2=182537&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/PythonDataObjects.cpp (original)
+++ lldb/trunk/source/Interpreter/PythonDataObjects.cpp Wed May 22 18:29:16 2013
@@ -15,6 +15,8 @@
 
 #else
 
+#include <stdio.h>
+
 #if defined (__APPLE__)
 #include <Python/Python.h>
 #else
@@ -43,19 +45,20 @@ PythonObject::Dump (Stream &strm) const
 {
     if (m_py_obj)
     {
-        FILE *file = tmpfile();
+        FILE *file = ::tmpfile();
         if (file)
         {
-            PyObject_Print (m_py_obj, file, 0);
+            ::PyObject_Print (m_py_obj, file, 0);
             const long length = ftell (file);
             if (length)
             {
-                rewind(file);
+                ::rewind(file);
                 std::vector<char> file_contents (length,'\0');
-                const size_t length_read = fread(file_contents.data(), 1, file_contents.size(), file);
+                const size_t length_read = ::fread (file_contents.data(), 1, file_contents.size(), file);
                 if (length_read > 0)
-                    strm.Write(file_contents.data(), length_read);
+                    strm.Write (file_contents.data(), length_read);
             }
+            ::fclose (file);
         }
     }
     else





More information about the lldb-commits mailing list