[Python-checkins] cpython (2.7): Fix a refleak in call_maybe()

victor.stinner python-checkins at python.org
Fri Aug 19 12:00:09 EDT 2016


https://hg.python.org/cpython/rev/7669fb39a9ce
changeset:   102771:7669fb39a9ce
branch:      2.7
parent:      102767:5b1ed48aedef
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Fri Aug 19 17:58:54 2016 +0200
summary:
  Fix a refleak in call_maybe()

Issue #27128. Fix a reference leak if creating the tuple to pass positional
parameters fails.

files:
  Objects/typeobject.c |  4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/Objects/typeobject.c b/Objects/typeobject.c
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -1314,8 +1314,10 @@
 
     va_end(va);
 
-    if (args == NULL)
+    if (args == NULL) {
+        Py_DECREF(func);
         return NULL;
+    }
 
     assert(PyTuple_Check(args));
     retval = PyObject_Call(func, args, NULL);

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list