summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-02-08 11:57:09 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2017-02-08 11:57:09 (GMT)
commit620580f280e3fe6583afee43580ef907b228add3 (patch)
tree50ec86c1b889968e9344e88af2eea7c81678c207 /Objects
parent17a63e2169cbd6799ea2f9af25f9b570cc02278a (diff)
downloadcpython-620580f280e3fe6583afee43580ef907b228add3.zip
cpython-620580f280e3fe6583afee43580ef907b228add3.tar.gz
cpython-620580f280e3fe6583afee43580ef907b228add3.tar.bz2
Fix refleaks if Py_EnterRecursiveCall() fails
Issue #29306: Destroy argstuple and kwdict if Py_EnterRecursiveCall() fails.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/abstract.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 8d18313..4d7f94a 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -2350,14 +2350,15 @@ _PyObject_FastCallDict(PyObject *callable, PyObject **args, Py_ssize_t nargs,
}
if (Py_EnterRecursiveCall(" while calling a Python object")) {
+ Py_DECREF(argstuple);
return NULL;
}
result = (*call)(callable, argstuple, kwargs);
Py_LeaveRecursiveCall();
-
Py_DECREF(argstuple);
+
result = _Py_CheckFunctionResult(callable, result, NULL);
return result;
}
@@ -2544,6 +2545,8 @@ _PyObject_FastCallKeywords(PyObject *callable, PyObject **stack, Py_ssize_t narg
}
if (Py_EnterRecursiveCall(" while calling a Python object")) {
+ Py_DECREF(argstuple);
+ Py_XDECREF(kwdict);
return NULL;
}