Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8c4c1f6

Browse files
committed
Issue #18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj()
1 parent 96f628f commit 8c4c1f6

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ Core and Builtins
4949
Library
5050
-------
5151

52+
- Issue #18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj()
53+
5254
- Issue #18513: Fix behaviour of cmath.rect w.r.t. signed zeros on OS X 10.8 +
5355
gcc.
5456

Modules/_ctypes/_ctypes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2671,8 +2671,8 @@ PyCData_FromBaseObj(PyObject *type, PyObject *base, Py_ssize_t index, char *adr)
26712671
cmem->b_index = index;
26722672
} else { /* copy contents of adr */
26732673
if (-1 == PyCData_MallocBuffer(cmem, dict)) {
2674-
return NULL;
26752674
Py_DECREF(cmem);
2675+
return NULL;
26762676
}
26772677
memcpy(cmem->b_ptr, adr, dict->size);
26782678
cmem->b_index = index;

0 commit comments

Comments
 (0)