mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
[3.14] gh-143145: Fix possible reference leak in ctypes _build_result() (GH-143131) (GH-143169)
The result tuple was leaked if __ctypes_from_outparam__() failed for any item.
(cherry picked from commit 579c5b496b)
Signed-off-by: Yongtao Huang <yongtaoh2022@gmail.com>
Co-authored-by: Yongtao Huang <yongtaoh2022@gmail.com>
This commit is contained in:
parent
8a61b71eee
commit
88a4d0d34b
2 changed files with 2 additions and 0 deletions
|
|
@ -0,0 +1 @@
|
|||
Fixed a possible reference leak in ctypes when constructing results with multiple output parameters on error.
|
||||
|
|
@ -4551,6 +4551,7 @@ _build_result(PyObject *result, PyObject *callargs,
|
|||
v = PyTuple_GET_ITEM(callargs, i);
|
||||
v = PyObject_CallMethodNoArgs(v, &_Py_ID(__ctypes_from_outparam__));
|
||||
if (v == NULL || numretvals == 1) {
|
||||
Py_XDECREF(tup);
|
||||
Py_DECREF(callargs);
|
||||
return v;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue