summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/ACKS1
-rw-r--r--Misc/NEWS3
-rw-r--r--Modules/_ctypes/_ctypes.c1
3 files changed, 5 insertions, 0 deletions
diff --git a/Misc/ACKS b/Misc/ACKS
index 84dad68..0d1a77b 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -828,6 +828,7 @@ Mark Russell
Nick Russo
Patrick Sabin
Sébastien Sablé
+Suman Saha
Hajime Saitou
George Sakkis
Rich Salz
diff --git a/Misc/NEWS b/Misc/NEWS
index 3c2ef37..b5e5b15 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -1295,6 +1295,9 @@ Tools/Demos
Extension Modules
-----------------
+- Issue #13013: ctypes: Fix a reference leak in PyCArrayType_from_ctype.
+ Thanks to Suman Saha for finding the bug and providing a patch.
+
- Issue #13022: Fix: _multiprocessing.recvfd() doesn't check that
file descriptor was actually received.
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 0c6f542..3df26da 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -4474,6 +4474,7 @@ PyCArrayType_from_ctype(PyObject *itemtype, Py_ssize_t length)
if (!PyType_Check(itemtype)) {
PyErr_SetString(PyExc_TypeError,
"Expected a type object");
+ Py_DECREF(key);
return NULL;
}
#ifdef MS_WIN64