From eb1258d4b3aea71bfdc06f71806d9693bb669617 Mon Sep 17 00:00:00 2001 From: Charalampos Stratakis Date: Thu, 28 Feb 2019 18:47:25 +0100 Subject: [PATCH 1/2] bpo-13096: Fix partial backport of issue 13096. Properly free the buf variable. --- Modules/_ctypes/callproc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c index 2097342085788ec..defcde1ff3e9654 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); From f314e35bda8951f75d8c84db43bf6fa994e9b4ef Mon Sep 17 00:00:00 2001 From: Charalampos Stratakis Date: Mon, 4 Mar 2019 16:13:08 +0100 Subject: [PATCH 2/2] Add news entry --- .../NEWS.d/next/Library/2019-03-04-16-13-01.bpo-13096.SGPt_n.rst | 1 + 1 file changed, 1 insertion(+) 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 000000000000000..2bf49c855f60caf --- /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.