summaryrefslogtreecommitdiffstats
path: root/lldb/scripts/Python/python-wrapper.swig
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-06-21 01:52:37 +0000
committerZachary Turner <zturner@google.com>2017-06-21 01:52:37 +0000
commit10a601adb2a6e47b1681aa01d7c410b89514b5fe (patch)
tree5036fe1dfa483527ec13df2f0ba7a8d86f6bbad7 /lldb/scripts/Python/python-wrapper.swig
parentca48d369bac37ee9f2d4b44c50303fb0b1e73b44 (diff)
downloadbcm5719-llvm-10a601adb2a6e47b1681aa01d7c410b89514b5fe.tar.gz
bcm5719-llvm-10a601adb2a6e47b1681aa01d7c410b89514b5fe.zip
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 llvm-svn: 305873
Diffstat (limited to 'lldb/scripts/Python/python-wrapper.swig')
-rw-r--r--lldb/scripts/Python/python-wrapper.swig3
1 files changed, 2 insertions, 1 deletions
diff --git a/lldb/scripts/Python/python-wrapper.swig b/lldb/scripts/Python/python-wrapper.swig
index a92102e3283..96b8dda80f8 100644
--- a/lldb/scripts/Python/python-wrapper.swig
+++ b/lldb/scripts/Python/python-wrapper.swig
@@ -929,7 +929,8 @@ void LLDBSwigPythonCallPythonLogOutputCallback(const char *str, void *baton);
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;
}
}
OpenPOWER on IntegriCloud