summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMeador Inge <meadori@gmail.com>2011-09-27 20:35:28 -0500
committerMeador Inge <meadori@gmail.com>2011-09-27 20:35:28 -0500
commitfe150036803ce14efbf3a1e7bf923f47eded0179 (patch)
treee642914993bcc8f55bb32ab87c407e17f4d226ac
parenta96b0d119d586b16f2b17fc36f49c44a5dde162d (diff)
downloadcpython-git-fe150036803ce14efbf3a1e7bf923f47eded0179.tar.gz
Issue #13013: ctypes: Fix a reference leak in PyCArrayType_from_ctype.
Thanks to Suman Saha for finding the bug and providing a patch.
-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 e728c511e1..6c02a79c7a 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -720,6 +720,7 @@ Sam Rushing
Mark Russell
Nick Russo
Sébastien Sablé
+Suman Saha
Hajime Saitou
George Sakkis
Rich Salz
diff --git a/Misc/NEWS b/Misc/NEWS
index c4f0cb09fe..132ea5e08b 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -207,6 +207,9 @@ Library
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 c4d08901cd..4ae2c4133e 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -4678,6 +4678,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