From: Benjamin Peterson Date: Sat, 14 Nov 2015 23:12:18 +0000 (-0800) Subject: fix possible memory lea k in _get_aia_uri (closes #25578) X-Git-Tag: v3.5.1rc1~41^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f0c9038a369eb846f184d1347a33ebb441d3ab6b;p=thirdparty%2FPython%2Fcpython.git fix possible memory lea k in _get_aia_uri (closes #25578) --- diff --git a/Misc/NEWS b/Misc/NEWS index 1390642451bd..881f0351e830 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -106,6 +106,8 @@ Core and Builtins Library ------- +- Issue #25578: Fix (another) memory leak in SSLSocket.getpeercer(). + - Issue #25590: In the Readline completer, only call getattr() once per attribute. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 23e9be767cd1..064ad01dec8b 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -977,7 +977,10 @@ _get_aia_uri(X509 *certificate, int nid) { AUTHORITY_INFO_ACCESS *info; info = X509_get_ext_d2i(certificate, NID_info_access, NULL, NULL); - if ((info == NULL) || (sk_ACCESS_DESCRIPTION_num(info) == 0)) { + if (info == NULL) + return Py_None; + if (sk_ACCESS_DESCRIPTION_num(info) == 0) { + AUTHORITY_INFO_ACCESS_free(info); return Py_None; }