summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS2
-rw-r--r--Modules/_ctypes/_ctypes.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 5b83f8a..602a5c7 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -159,6 +159,8 @@ Core and Builtins
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
index 62a083b..6f40b1a 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -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;