]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-38532: Add missing decrefs in PyCFuncPtr_FromDll() (GH-16857)
authorZackery Spytz <zspytz@gmail.com>
Fri, 3 Jan 2020 12:16:12 +0000 (05:16 -0700)
committerT. Wouters <thomas@python.org>
Fri, 3 Jan 2020 12:16:12 +0000 (13:16 +0100)
Modules/_ctypes/_ctypes.c

index d38d892be621c08e4a6558d4e51b904324e6bba8..93af497bda25f75a526d38c5934bb5fa4e1c3e76 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