[Lldb-commits] [lldb] r305873 - Fix a python object leak in SWIG glue.
Zachary Turner via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 20 18:52:37 PDT 2017
Author: zturner
Date: Tue Jun 20 20:52:37 2017
New Revision: 305873
URL: http://llvm.org/viewvc/llvm-project?rev=305873&view=rev
Log:
Fix a python object leak in SWIG glue.
PyObject_CallFunction returns a PyObject which needs to be
decref'ed when it is no longer needed.
Patch by David Luyer
Differential Revision: https://reviews.llvm.org/D33740
Modified:
lldb/trunk/scripts/Python/python-wrapper.swig
Modified: lldb/trunk/scripts/Python/python-wrapper.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-wrapper.swig?rev=305873&r1=305872&r2=305873&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/python-wrapper.swig (original)
+++ lldb/trunk/scripts/Python/python-wrapper.swig Tue Jun 20 20:52:37 2017
@@ -929,7 +929,8 @@ void LLDBSwigPythonCallPythonLogOutputCa
void LLDBSwigPythonCallPythonLogOutputCallback(const char *str, void *baton) {
if (baton != Py_None) {
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
- PyObject_CallFunction(reinterpret_cast<PyObject*>(baton), const_cast<char*>("s"), str);
+ PyObject *result = PyObject_CallFunction(reinterpret_cast<PyObject*>(baton), const_cast<char*>("s"), str);
+ Py_XDECREF(result);
SWIG_PYTHON_THREAD_END_BLOCK;
}
}
More information about the lldb-commits
mailing list