llvm-project/lldb/scripts
Stephane Sezer 65fd8f4345 Fix FILE * leak in Python API
Summary:
This fixes a leak introduced by some of these changes:
r257644
r250530
r250525

The changes made in these patches result in leaking the FILE* passed
to SetImmediateOutputFile. GetStream() will dup() the fd held by the
python caller and create a new FILE*. It will then pass this FILE*
to SetImmediateOutputFile, which always uses the flag
transfer_ownership=false when it creates a File from the FILE*.

Since transfer_ownership is false, the lldb File destructor will not
close the underlying FILE*. Because this FILE* came from a dup-ed fd,
it will also not be closed when the python caller closes its file.

Leaking the FILE* causes issues if the same file is used multiple times
by different python callers during the same lldb run, even if these
callers open and close the python file properly, as you can end up
with issues due to multiple buffered writes to the same file.

Reviewers: granata.enrico, zturner, clayborg

Subscribers: zturner, lldb-commits, sas

Differential Revision: http://reviews.llvm.org/D18459

Change by Francis Ricci <fjricci@fb.com>

llvm-svn: 264476
2016-03-25 23:40:32 +00:00
..
Python Fix a build issue where the python module could become stale. 2016-03-18 22:33:59 +00:00
Xcode Use shallow clones in build-llvm.py. 2016-03-02 20:53:19 +00:00
interface Fix FILE * leak in Python API 2016-03-25 23:40:32 +00:00
swig_bot_lib Use sub-commands instead of --mode={client,server}. 2015-12-02 19:00:52 +00:00
CMakeLists.txt Remove superseded buildSwigWrapperClasses.py and buildSwigPython.py classes 2015-11-18 22:21:47 +00:00
build-lldb-llvm-clang
buildbot.py
checkpoint-llvm.pl Fix typos. 2014-07-01 21:22:11 +00:00
disasm-gdb-remote.pl Fix typos. 2014-07-01 21:22:11 +00:00
finish-swig-wrapper-classes.sh Fixed Makefile-based install to place python packages in the LLDB install tree. 2013-12-06 23:16:23 +00:00
finishSwigWrapperClasses.py Be *stupider* about what constitutes a supported language binding. 2015-11-25 17:49:47 +00:00
generate-vers.pl Make lldb build with Makefiles on OS X. 2014-01-18 08:05:32 +00:00
get_relative_lib_dir.py Support RHEL 7 and similar systems that use architecture-specific Python lib dirs 2015-10-12 20:12:27 +00:00
install-lldb.sh
install_custom_python.py Making linking against Python simpler on Windows. 2015-04-10 22:58:56 +00:00
lldb.swig Fix non-Windows build after r252906. 2015-11-12 17:01:48 +00:00
prepare_bindings.py Fix SBDebugger.GetOutputFileHandle() on OS X. 2016-03-11 01:57:45 +00:00
sed-sources Fix typos. 2014-07-01 21:22:11 +00:00
shush Several improvements to the shush script 2015-01-16 23:16:22 +00:00
swig_bot.py Use sub-commands instead of --mode={client,server}. 2015-12-02 19:00:52 +00:00
use_lldb_suite.py Fix ResourceWarning about unclosed file in use_lldb_suite_root.py. 2016-01-15 22:22:35 +00:00
utilsArgsParse.py [swig] Start of pylint on python build scripts. 2015-11-05 23:57:33 +00:00
utilsDebug.py [swig] Start of pylint on python build scripts. 2015-11-05 23:57:33 +00:00
utilsOsType.py [swig] Start of pylint on python build scripts. 2015-11-05 23:57:33 +00:00
verify_api.py