[Python-checkins] cpython (merge 3.3 -> default): Issue #18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj()

christian.heimes python-checkins at python.org
Sun Jul 21 16:25:43 CEST 2013


http://hg.python.org/cpython/rev/afe119a3619f
changeset:   84765:afe119a3619f
parent:      84763:c18bb06892e9
parent:      84764:25ffad2e12d6
user:        Christian Heimes <christian at cheimes.de>
date:        Sun Jul 21 16:25:30 2013 +0200
summary:
  Issue #18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj()

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


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -159,6 +159,8 @@
 Library
 -------
 
+- Issue #18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj()
+
 - Issue #9177: Calling read() or write() now raises ValueError, not
   AttributeError, on a closed SSL socket.  Patch by Senko Rasic.
 
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -2671,8 +2671,8 @@
         cmem->b_index = index;
     } else { /* copy contents of adr */
         if (-1 == PyCData_MallocBuffer(cmem, dict)) {
+            Py_DECREF(cmem);
             return NULL;
-            Py_DECREF(cmem);
         }
         memcpy(cmem->b_ptr, adr, dict->size);
         cmem->b_index = index;

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


More information about the Python-checkins mailing list