python2/0349-2.7-bpo-13096-Fix-memory-leak-in-ctypes-POINTER-hand.patch
2019-09-30 11:14:30 -04:00

35 lines
1.4 KiB
Diff

From 710dcfd2f4bee034894a39026388f9c21ea976f1 Mon Sep 17 00:00:00 2001
From: stratakis <cstratak@redhat.com>
Date: Mon, 4 Mar 2019 16:40:25 +0100
Subject: [PATCH 349/362] [2.7] bpo-13096: Fix memory leak in ctypes POINTER
handling of large values (GH-12100)
---
Misc/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 0000000..2bf49c8
--- /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 2097342..defcde1 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);
--
1.8.3.1