From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Fri, 3 Jan 2020 12:50:11 +0000 (-0800) Subject: bpo-38532: Add missing decrefs in PyCFuncPtr_FromDll() (GH-17811) X-Git-Tag: v3.8.2rc1~112 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=aa3efea9c5f4d25afc3fa4cfd5e6d789943893c9;p=thirdparty%2FPython%2Fcpython.git bpo-38532: Add missing decrefs in PyCFuncPtr_FromDll() (GH-17811) (cherry picked from commit e02ab59fdffa0bb841182c30ef1355c89578d945) Co-authored-by: Zackery Spytz --- diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 347a3656b625..c6da0d804453 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -3554,10 +3554,12 @@ PyCFuncPtr_FromDll(PyTypeObject *type, PyObject *args, PyObject *kwds) if (PySys_Audit("ctypes.dlsym", ((uintptr_t)name & ~0xFFFF) ? "Os" : "On", dll, name) < 0) { + Py_DECREF(ftuple); return NULL; } #else if (PySys_Audit("ctypes.dlsym", "Os", dll, name) < 0) { + Py_DECREF(ftuple); return NULL; } #endif