]> granicus.if.org Git - python/commitdiff
Issue #13013: ctypes: Fix a reference leak in PyCArrayType_from_ctype.
authorMeador Inge <meadori@gmail.com>
Wed, 28 Sep 2011 01:35:28 +0000 (20:35 -0500)
committerMeador Inge <meadori@gmail.com>
Wed, 28 Sep 2011 01:35:28 +0000 (20:35 -0500)
Thanks to Suman Saha for finding the bug and providing a patch.

Misc/ACKS
Misc/NEWS
Modules/_ctypes/_ctypes.c

index e728c511e13bd30c4b7fc0f709c1aeba5e48108b..6c02a79c7a83db63d59e37d8a12fc058e2dbc031 100644 (file)
--- 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
index c4f0cb09fe6a03e07a617e7796a5e963ae800e7e..132ea5e08b992d768349df42325623c16d710b68 100644 (file)
--- 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.
 
index c4d08901cd3fb21596aab5c7d1fd62466893b5cc..4ae2c4133e85636cb1a82e3eb6dcd32ef590b65a 100644 (file)
@@ -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