Issue #18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj()
authorChristian Heimes <christian@cheimes.de>
Sun, 21 Jul 2013 14:24:51 +0000 (16:24 +0200)
committerChristian Heimes <christian@cheimes.de>
Sun, 21 Jul 2013 14:24:51 +0000 (16:24 +0200)
Misc/NEWS
Modules/_ctypes/_ctypes.c

index f79f62584aa83cac4aa61490fde851b856e53cde..3b45833439e5e1eb1ec022f905369961bdd5bc3c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -49,6 +49,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj()
+
 - Issue #18513: Fix behaviour of cmath.rect w.r.t. signed zeros on OS X 10.8 +
   gcc.
 
index c1956945c9de44c86cca0fef5d12994d7b086fb0..a025a732f6d0180953ce05d4fce50fe6f9a56d02 100644 (file)
@@ -2671,8 +2671,8 @@ PyCData_FromBaseObj(PyObject *type, PyObject *base, Py_ssize_t index, char *adr)
         cmem->b_index = index;
     } else { /* copy contents of adr */
         if (-1 == PyCData_MallocBuffer(cmem, dict)) {
-            return NULL;
             Py_DECREF(cmem);
+            return NULL;
         }
         memcpy(cmem->b_ptr, adr, dict->size);
         cmem->b_index = index;