[Python-checkins] cpython (3.2): Issue #13014: Fix a possible reference leak in SSLSocket.getpeercert().
antoine.pitrou
python-checkins at python.org
Wed Feb 15 22:34:39 CET 2012
http://hg.python.org/cpython/rev/f3a4c2b34973
changeset: 74963:f3a4c2b34973
branch: 3.2
parent: 74959:9eb77d455be1
user: Antoine Pitrou <solipsis at pitrou.net>
date: Wed Feb 15 22:25:27 2012 +0100
summary:
Issue #13014: Fix a possible reference leak in SSLSocket.getpeercert().
files:
Misc/NEWS | 2 ++
Modules/_ssl.c | 23 ++++++++++++++---------
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -116,6 +116,8 @@
Library
-------
+- Issue #13014: Fix a possible reference leak in SSLSocket.getpeercert().
+
- Issue #13015: Fix a possible reference leak in defaultdict.__repr__.
Patch by Suman Saha.
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -519,15 +519,20 @@
goto fail1;
}
/* now, there's typically a dangling RDN */
- if ((rdn != NULL) && (PyList_Size(rdn) > 0)) {
- rdnt = PyList_AsTuple(rdn);
- Py_DECREF(rdn);
- if (rdnt == NULL)
- goto fail0;
- retcode = PyList_Append(dn, rdnt);
- Py_DECREF(rdnt);
- if (retcode < 0)
- goto fail0;
+ if (rdn != NULL) {
+ if (PyList_GET_SIZE(rdn) > 0) {
+ rdnt = PyList_AsTuple(rdn);
+ Py_DECREF(rdn);
+ if (rdnt == NULL)
+ goto fail0;
+ retcode = PyList_Append(dn, rdnt);
+ Py_DECREF(rdnt);
+ if (retcode < 0)
+ goto fail0;
+ }
+ else {
+ Py_DECREF(rdn);
+ }
}
/* convert list to tuple */
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list