]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-38532: Add missing decrefs in PyCFuncPtr_FromDll() (GH-17811)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 3 Jan 2020 12:50:11 +0000 (04:50 -0800)
committerT. Wouters <thomas@python.org>
Fri, 3 Jan 2020 12:50:11 +0000 (13:50 +0100)
(cherry picked from commit e02ab59fdffa0bb841182c30ef1355c89578d945)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Modules/_ctypes/_ctypes.c

index 347a3656b62578a0632fb07de95d74f55fff48c8..c6da0d804453e798654e64c8128bf059e1d61493 100644 (file)
@@ -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