]> 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:45:30 +0000 (20:45 -0500)
committerMeador Inge <meadori@gmail.com>
Wed, 28 Sep 2011 01:45:30 +0000 (20:45 -0500)
Thanks to Suman Saha for finding the bug and providing a patch.

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

index a1edc77b2fe63e902fc3ec6e6f310791ccca51b6..6845faaac6272e090454ba9eaab91843650b7fd5 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -774,6 +774,7 @@ Sam Rushing
 Mark Russell
 Nick Russo
 SĂ©bastien SablĂ©
+Suman Saha
 Hajime Saitou
 George Sakkis
 Rich Salz
index 1b0373663ea861ae7b41d354a5cf5d407028f079..b5c75b49cd84d5be0b2cd0f58cdc58d648e16ff9 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -82,6 +82,9 @@ Tests
 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 17a00f5c19eb0ce7b1411a0da4e44e92428d7f33..8f378e246df652021b76b351b888446028f6193f 100644 (file)
@@ -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