diff --git a/Misc/NEWS.d/next/Library/2019-03-04-16-13-01.bpo-13096.SGPt_n.rst b/Misc/NEWS.d/next/Library/2019-03-04-16-13-01.bpo-13096.SGPt_n.rst new file mode 100644 index 00000000000000..2bf49c855f60ca --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-03-04-16-13-01.bpo-13096.SGPt_n.rst @@ -0,0 +1 @@ +Fix memory leak in ctypes POINTER handling of large values. diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c index 2097342085788e..defcde1ff3e965 100644 --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -1831,6 +1831,7 @@ POINTER(PyObject *self, PyObject *cls) "s(O){}", buf, &PyCPointer_Type); + PyMem_Free(buf); if (result == NULL) return result; key = PyLong_FromVoidPtr(result);