diff options
| author | Antoine Pitrou <solipsis@pitrou.net> | 2012-02-15 21:25:27 (GMT) |
|---|---|---|
| committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-02-15 21:25:27 (GMT) |
| commit | dd7e071b23e7f4b33767653b3feea0ffb2bfa6b9 (patch) | |
| tree | 9f817497bf395bab5e3525da143285bc1313c9bc | |
| parent | c82da813c1406bc7e3878bf1d960d4765bcb0d89 (diff) | |
| download | cpython-dd7e071b23e7f4b33767653b3feea0ffb2bfa6b9.zip cpython-dd7e071b23e7f4b33767653b3feea0ffb2bfa6b9.tar.gz cpython-dd7e071b23e7f4b33767653b3feea0ffb2bfa6b9.tar.bz2 | |
Issue #13014: Fix a possible reference leak in SSLSocket.getpeercert().
| -rw-r--r-- | Misc/NEWS | 2 | ||||
| -rw-r--r-- | Modules/_ssl.c | 23 |
2 files changed, 16 insertions, 9 deletions
@@ -93,6 +93,8 @@ Core and Builtins Library ------- +- Issue #13014: Fix a possible reference leak in SSLSocket.getpeercert(). + - Issue #13987: HTMLParser is now able to handle EOFs in the middle of a construct and malformed start tags. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index eaf67c4..e692b5d 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -644,15 +644,20 @@ _create_tuple_for_X509_NAME (X509_NAME *xname) 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 */ |
