[PATCH] D33740: Fix ref-leak in LLDBSwigPythonCallPythonLogOutputCallback

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 20 18:53:26 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL305873: Fix a python object leak in SWIG glue. (authored by zturner).

Changed prior to commit:
  https://reviews.llvm.org/D33740?vs=100918&id=103317#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33740

Files:
  lldb/trunk/scripts/Python/python-wrapper.swig


Index: lldb/trunk/scripts/Python/python-wrapper.swig
===================================================================
--- lldb/trunk/scripts/Python/python-wrapper.swig
+++ lldb/trunk/scripts/Python/python-wrapper.swig
@@ -929,7 +929,8 @@
 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;
     }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33740.103317.patch
Type: text/x-patch
Size: 669 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170621/640c1420/attachment-0001.bin>


More information about the llvm-commits mailing list