[Python-checkins] bpo-38532: Add missing decrefs in PyCFuncPtr_FromDll() (GH-17811)

T. Wouters webhook-mailer at python.org
Fri Jan 3 07:50:20 EST 2020


https://github.com/python/cpython/commit/aa3efea9c5f4d25afc3fa4cfd5e6d789943893c9
commit: aa3efea9c5f4d25afc3fa4cfd5e6d789943893c9
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: T. Wouters <thomas at python.org>
date: 2020-01-03T13:50:11+01:00
summary:

bpo-38532: Add missing decrefs in PyCFuncPtr_FromDll() (GH-17811)

(cherry picked from commit e02ab59fdffa0bb841182c30ef1355c89578d945)

Co-authored-by: Zackery Spytz <zspytz at gmail.com>

files:
M Modules/_ctypes/_ctypes.c

diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 347a3656b6257..c6da0d804453e 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



More information about the Python-checkins mailing list