From 710dcfd2f4bee034894a39026388f9c21ea976f1 Mon Sep 17 00:00:00 2001 From: stratakis Date: Mon, 4 Mar 2019 16:40:25 +0100 Subject: [PATCH] [2.7] bpo-13096: Fix memory leak in ctypes POINTER handling of large values (GH-12100) --- .../NEWS.d/next/Library/2019-03-04-16-13-01.bpo-13096.SGPt_n.rst | 1 + Modules/_ctypes/callproc.c | 1 + 2 files changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2019-03-04-16-13-01.bpo-13096.SGPt_n.rst 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 000000000000..2bf49c855f60 --- /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 209734208578..defcde1ff3e9 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); -- 2.47.3