From 10a601adb2a6e47b1681aa01d7c410b89514b5fe Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Wed, 21 Jun 2017 01:52:37 +0000 Subject: 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 --- lldb/scripts/Python/python-wrapper.swig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lldb/scripts/Python/python-wrapper.swig') diff --git a/lldb/scripts/Python/python-wrapper.swig b/lldb/scripts/Python/python-wrapper.swig index a92102e..96b8dda 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(baton), const_cast("s"), str); + PyObject *result = PyObject_CallFunction(reinterpret_cast(baton), const_cast("s"), str); + Py_XDECREF(result); SWIG_PYTHON_THREAD_END_BLOCK; } } -- cgit v1.1