[Python-checkins] cpython (3.2): Issue #13013: ctypes: Fix a reference leak in PyCArrayType_from_ctype.

meador.inge python-checkins at python.org
Wed Sep 28 03:57:25 CEST 2011


http://hg.python.org/cpython/rev/58a75eeb5c8e
changeset:   72473:58a75eeb5c8e
branch:      3.2
parent:      72469:4951ffc178db
user:        Meador Inge <meadori at gmail.com>
date:        Tue Sep 27 20:45:30 2011 -0500
summary:
  Issue #13013: ctypes: Fix a reference leak in PyCArrayType_from_ctype.

Thanks to Suman Saha for finding the bug and providing a patch.

files:
  Misc/ACKS                 |  1 +
  Misc/NEWS                 |  3 +++
  Modules/_ctypes/_ctypes.c |  1 +
  3 files changed, 5 insertions(+), 0 deletions(-)


diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -774,6 +774,7 @@
 Mark Russell
 Nick Russo
 Sébastien Sablé
+Suman Saha
 Hajime Saitou
 George Sakkis
 Rich Salz
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -82,6 +82,9 @@
 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
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -4474,6 +4474,7 @@
     if (!PyType_Check(itemtype)) {
         PyErr_SetString(PyExc_TypeError,
                         "Expected a type object");
+        Py_DECREF(key);
         return NULL;
     }
 #ifdef MS_WIN64

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list