The result tuple was leaked if __ctypes_from_outparam__() failed for any item.
(cherry picked from commit
579c5b496b467a2b175cb30caa4f6873cb13c9a1)
Signed-off-by: Yongtao Huang <yongtaoh2022@gmail.com>
Co-authored-by: Yongtao Huang <yongtaoh2022@gmail.com>
--- /dev/null
+Fixed a possible reference leak in ctypes when constructing results with multiple output parameters on error.
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;
}